Saturday, 15 January 2011

php imagick error (ImageMagick 6.5.4 library for php version 5.3.1.3 and wamp server ,system 32 bit) -



php imagick error (ImageMagick 6.5.4 library for php version 5.3.1.3 and wamp server ,system 32 bit) -

i have installed imagemagick 6.5.4 library php version 5.3.1.3 , wamp server, scheme 32 bit.

i tried blur on images , draw circles , primitives , go in right way. when tried code have imagick statement have result

fatal error: class 'imagick' not found in c:\wamp\www\t\code.php on line 2

how solve problem ?

imagick needs activated in php.ini file , in case need right imagick.dll file go it. can frustrating business need right .dll go php version , has compiled right version of - can not remember now.

it not supported , find frustrating use. recomend stick exec( ) , command line.

php imagemagick imagick

asp.net - error when using textbox ,ajax calender extender and compare validator -



asp.net - error when using textbox ,ajax calender extender and compare validator -

i used textbox textchanged event,autopostback true ,ajax calender extender , kepted compare validator checking date greaterthan today, if come in wrong date validation error appears , disappears immediatly , textbox event firing ? how stop event firing & showing error

asp.net

mongodb - How to populate fields after mapReduce with Mongoose.js? -



mongodb - How to populate fields after mapReduce with Mongoose.js? -

i want populate fields after mapreduce.

mongoose.connection.db.collection('createdcollectionnameforresults', function(err, collection) { collection.find({}).populate('ref_field').toarray(function(err, items) { res.send(200, items) }); });

but here, gives error:

typeerror: object # has no method 'populate'

because collection.find({}) returns mongodb cursor. how can populate ref_field?

considering have schema registered in mongoose named 'createdcollectionnameforresults'

var model = mongoose.model('createdcollectionnameforresults'); model.find({}).populate('ref_field').exec(function(err, results){ console.log(err, results); });

mongodb mapreduce mongoose

c# - Calling asmx web service using JQuery with parameters causes 500 error -



c# - Calling asmx web service using JQuery with parameters causes 500 error -

i have simple plenty web service:

[scriptmethod(usehttpget = true, responseformat = responseformat.json)] [webmethod] public string gettoken(string a) { }

and i'm calling client side using jquery:

$.ajax({ post: 'get', contenttype: "application/json; charset=utf-8", datatype: 'json', url: '../url/gettoken', data: "{'a':'test'}", success: function (data) { }, error: function (a, b, c) { } });

the phone call fails , error returned 500 internal server error. have placed breakpoint within web service, , code isn't beingness reached @ all. when modify web service take no arguments @ (and remove data element jquery call) phone call succeeds. have played around different ways pass data element; i've passed json object (no quotes), , i've removed quotes around a argument. none of works.

edit:

using fiddler have determined actual error causing 500 "invalid web service call, missing value parameter".

edit 2:

passing info way works:

data: "a='test'"

i have no thought why. ideas?

haven't tested this, in code snippet have post: 'get' rather type: 'get'. may causing server reject contenttype json (which why info isn't beingness serialized properly).

c# web-services jquery asmx

java - Capture images and store them only inside apk in android? -



java - Capture images and store them only inside apk in android? -

i want utilize device photographic camera , capture image , convert lower quality image , store image within "assets" instead within cellphone .

i not expecting total code , thought in general great .

the main issue how image taking image assets can utilize .

thanks !

no can't that... after apk build, can't insert within @ run time. can save info on either internal memory or external memory not within apk(through mechanism)

java android android-intent camera assets

Not able to open a portlet in liferay dialog -



Not able to open a portlet in liferay dialog -

i have dialog in portal opens portlet. when click on link , dialog opens, dialog shows

you not have roles required access portlet.

however, if add together same portlet on page, portlet opens without hitch, both on page , dialog. missing here? got thought ?

my codes :

#set ($profile_url = $portleturlfactory.create($request, "profile_war_profileportlet", $getterutil.getlong($plid), "render_phase")) $profile_url.setparameter("p_p_state", "exclusive") <a href="#" id="profile" onclick="opendialog('$profile_url','preferences-dialog',500,500)"> profile </a> window, 'opendialog', //function name function(url, popupid, wd, ht) { // parameters function var = aui(); popupdialog = new a.dialog({ id: popupid, // popupid passed easy close through events other close button centered: false, // different parameters function can check in alloy api draggable: true, resizable: false, width: wd, stack: true, modal: true, height: ht, scrollbars: true, xy: [getwidth()/2-wd/2,10] } ).plug( a.plugin.io, { uri: url } ); popupdialog.render(); }, ['aui-dialog','aui-dialog-iframe'] );

thanks in advance help can provide.

i think missing next configuration in liferay-portlet.xml of profile_war_profileportlet portlet:

<add-default-resource>true</add-default-resource>

this should set true portlet accessed within dialog pop-up, here documentation element.

for more info can @ answer points 4 & 5 of reply of help you.

dialog liferay portlet portal

java - Obliterate the URL -



java - Obliterate the URL -

i have ajax application phone call servlet run study , homecoming pdf. works pretty well, except user presented web page have study name , client id. changing client id allow them run same study person. yikes!

i recall things url re-writing, used dubiously session management. wondering if modify url within servlet user gets can't hacked @ other reports. how go this?

also, have improve idea?

thanks.

simply utilize (anonymous) session id file part. , allow servlet stream file in file scheme adding session id.

this assumes command flow can't done easier because of ajax , doing 2 things @ once.

java java-ee

javafx 2 - View FXML code without saving to an file first? -



javafx 2 - View FXML code without saving to an file first? -

in javafx scene builder, somehow possible view fxml code current layout without saving file , view saved file?

right click on root node in scene builder , take re-create . , paste in text editor.

out set :

<group id="sb-clipboard" xmlns:fx="http://javafx.com/fxml"> <fx:define> <anchorpane id="anchorpane" maxheight="-infinity" maxwidth="-infinity" minheight="-infinity" minwidth="-infinity" prefheight="400.0" prefwidth="600.0"> <children> <button id="button1" layoutx="140.0" layouty="104.0" mnemonicparsing="false" text="button" /> <radiobutton id="radiobutton1" layoutx="283.0" layouty="172.0" mnemonicparsing="false" text="radiobutton" /> <togglebutton id="togglebutton1" layoutx="94.0" layouty="234.0" mnemonicparsing="false" text="togglebutton" /> </children> </anchorpane> </fx:define> </group>

javafx-2 scenebuilder

php - Magento product getFinalPrice for customer in custom script -



php - Magento product getFinalPrice for customer in custom script -

i have several catalog cost rules client groups. when viewing product logged-in client cost displays correctly. create inventory file can send client has discounted pricing. how do it?

what i've tried:

starting session client (with mage::getsingleton('customer/session')->loginbyid($customerid)) before getting product collection, didn't seem impact $product->getfinalprice().

edit: should i've confirmed session working correctly echoing client grouping id session.

adding product sales/quote created customer, getting cost off of quote_item didn't work either.

i followed mage_catalog_model_product::getfinalprice() , found 2 event observers, mage_catalogrule_model_observer::processfrontfinalprice() , processadminfinalprice(). looks should able set client grouping id on product i've tried doing ... no luck. logic determine client grouping id in processfrontfinalprice() shown below:

if ($observer->hascustomergroupid()) { $gid = $observer->getevent()->getcustomergroupid(); } elseif ($product->hascustomergroupid()) { $gid = $product->getcustomergroupid(); } else { $gid = mage::getsingleton('customer/session')->getcustomergroupid(); }

did check method head? public function login($username, $password). can't utilize login() customerid.

but there is:

mage::getsingleton('customer/session')->loginbyid($customerid);

php magento

php - Calculating Total salary, Based on Hours in postgres -



php - Calculating Total salary, Based on Hours in postgres -

i want write query to calculate total pay base of operations on working hours.

in case have 2 tables :

machinetypes fields machine_rent(per hr bases). machines (it maintains info of machine comes on daily basis like: machine_name, timein, timeout, task)

now want populate total amount of particular machine, how many hours machine worked , multiply machine_rent calculate totalpay.

ok, how this sqlfiddle?

i created random usage , took current on-demand aws per-instance cost (linux in virginia).

exercise reader: computing grand total should self-evident.

php postgresql

css - How to create a specific layout in html? -



css - How to create a specific layout in html? -

i create specific layout in html have dificulties.

images easier understand words, here have:

this fine, div1 gets heigher, have this:

and goal have that:

for moment, using divs, not idea. help welcome. give thanks much in advance.

divs great way it. can utilize floated layout containing div around 2 right divs. here code show mean:

html

<div id="wrapper" class="clearfix"> <div id="sidebar"></div> <div id="main_content"> <div id="top_right"></div> <div id="bottom_right"></div> </div> </div>

css

#wrapper { background: #44bbf0; } #sidebar { float: left; width: 100px; height: 500px; background: #485f40; } #main_content { float: right; } #top_right { width: 200px; height: 200px; background: #ff553f; } #botom_right { width: 200px; height: 300px; background: #b0de91; } .clearfix:before, .clearfix:after { content: "."; display: block; height: 0; overflow: hidden; } .clearfix:after { clear: both; } .clearfix { zoom: 1; /* ie < 8 */ }

here js fiddle link show how looks: http://jsfiddle.net/ddxyb/

make sure clear wrapper div. because contains floated elements, have no height if don't. in illustration used, set heights save time, if used automatic heights , allow divs take on height of content.

this screenshot jsfiddle code:

css layout html

iphone - Why my Xcode 4.6 localize file only can choose English? -



iphone - Why my Xcode 4.6 localize file only can choose English? -

i can take englist localizing file in xcode 4.6.

is bug of xcode 4.6?

how localize file now?

special thanks!

before localize file have add together language application, see image below:

iphone ios xcode

How to make hover on table cells with Javascript? -



How to make hover on table cells with Javascript? -

i have table hover function on rows, trying alter hover on cells instead

here's current script:

<script type="text/javascript"> window.onload=function(){ var tfrow = document.getelementbyid('tfhover').rows.length; var tbrow=[]; (var i=1;i<tfrow;i++) { tbrow[i]=document.getelementbyid('tfhover').rows[i]; tbrow[i].onmouseover = function(){ this.style.backgroundcolor = '#f3f8aa'; }; tbrow[i].onmouseout = function() { this.style.backgroundcolor = '#ffffff'; }; } }; </script>

and here tried alter far still not working:

<script type="text/javascript"> window.onload=function(){ var tfcell = document.getelementbyid('tfhover').cells.length; var tbcell=[]; (var i=1;i<tfcell;i++) { tbcell[i]=document.getelementbyid('tfhover').cells[i]; tbcell[i].onmouseover = function(){ this.style.backgroundcolor = '#f3f8aa'; }; tbcell[i].onmouseout = function() { this.style.backgroundcolor = '#ffffff'; }; } }; </script>

how can accomplish hover on cell instead of hover on row script?

you can utilize regular css purpose:

#tfhover td { background-color: #fff; } #tfhover td:hover { background-color: #f3f8aa; }

thanks @mike brant pointing out missing table id

javascript hover

html - VB.NET / C#.Net MSHTML: Unable to get "name" attribute from Outerhtml after using "setAttribute('name',value)" for certain elements -



html - VB.NET / C#.Net MSHTML: Unable to get "name" attribute from Outerhtml after using "setAttribute('name',value)" for certain elements -

i developing wysiwyg application company usage custom integration company's existing tools.

i unable "name" attribute out of elements when trying html string using ".outerhtml", input tag element.

code example: `dim inelem windows.forms.htmlelement = hdoc.createelement("input")` `inelem.id = "txt01"` `inelem.setattribute("name", inelem.id)` `inelem.setattribute("type", "text")` `inelem.setattribute("placeholder","text here....")` '' append created element html body `hdoc.body.appendchild(inelem)` --> getting html string: ** hdoc.body.getelementbyid("txt01").outerhtml => "<input id=txt01 placeholder='text here....'></input>" --> want is: ** hdoc.body.getelementbyid("txt01").outerhtml => "<input id=txt01 placeholder='text here....' type='text' name='txt01'></input>"

yes, not name attribute missing, other too. (e.g. type) help me on matter?

solution attempted: each inputele windows.forms.htmlelement in hdoc.body.getelementsbytagname("input") ctype(inputele.domelement, mshtml.ihtmlinputelement).name = inputele.id next

** failed ** :(

ultimate solution: utilize html agility pack: ---------------------- dim inputele3 htmlagilitypack.htmlnode = new_wb.createelement("input") inputele3.attributes.add("id", "txt01") inputele3.attributes.add("name", inputele3.id) inputele3.attributes.add("type", "text") inputele3.attributes.add("placeholder", "text here ....") result: ------- inputele3.outerhtml => <input id="txt01" name="txt01" type="text" placeholder="text here ...." >

it works now, provided utilize htmlagilitypack.dll :( microsoft mshtml sucks! :(

this worked me. forgive me using dynamic datatype, not have mshtml library on visual studio reason.

private void form1_load(object sender, eventargs e) { this.webbrowser1.navigate("about:blank"); this.webbrowser1.document.write("<input id='hell' class='blah' placeholder='text here' name='hell' type='text'></input>"); dynamic htmldoc = webbrowser1.document.domdocument dynamic; dynamic node = htmldoc.getelementbyid("hell") dynamic; string x = node.outerhtml; //gets name not type string s = node.getattribute["type"]; //gets type string name = node.getattribute["name"]; //gets name }

so outerhtml per did not attribute, when calling getattribute method did work. hopefuly helps.

c# html vb.net mshtml outerhtml

visual studio - How to enforce merging for hotfixes in TFS? -



visual studio - How to enforce merging for hotfixes in TFS? -

we using tfs advanced branch plan:

is there way can enforce hotfixes must merged servicing branch? had incident whereby deploy v1.2.0 of application, did not contain changes made in v1.1.1.

or have manually enforced process?

we have automatically-scheduled script performs such merges. gist of is:

tf merge src dest tf resolve /auto:automerge tf checkin

it's elaborate post here, since has much logging , monitoring - alerts me whenever there's merge conflict, etc.

visual-studio tfs merge tfs2010 branching-and-merging

math - The set operation X and set-roster notation? -



math - The set operation X and set-roster notation? -

let s = {2,4,6} , t = {1,3,5}. utilize set-roster notation write each of next sets, , indicate number of elements in each set?

a. s x t

b. t x s

c. s x s

d. t x t

the problem don't know what's flying here, there no examples in book can help.

i confident s x t supposed interpreted s × t, cartesian product of s , t. set of pairs first element comes s , sec element comes t. given s = {2, 4, 6} , t = {1, 3, 5}, set

{ (2, 1), (2, 3), (2, 5), (4, 1), (4, 3), (4, 5), (6, 1), (6, 3), (6, 5) }

using starting point, should able reply parts (b) through (d). term "set-roster notation" refers notation of listing off elements 1 @ time, i've done above.

hope helps!

math computer-science notation

Basic Match Making for Django and Python -



Basic Match Making for Django and Python -

so have model education attached userprofile. model works 1 assumes: user has gone several schools in different areas.

what i'm trying create "score" depending on users went. basically, if went same school, 10 points, same city, 5 points, same state, 2 points, , on.

i've made functions effort have failed. advice?

info = {} def edu_info(user1): user_1_cities = [] user_1_schools = [] user_1_state = [] first_one = education.objects.filter(owner=user1) in first_one: user_1_cities.append(str(i.city)) user_1_schools.append(str(i.school)) user_1_state.append(str(i.state)) info[str(i.owner.username)] = {} info[str(i.owner.username)]['cities'] = user_1_cities info[str(i.owner.username)]['schools'] = user_1_schools info[str(i.owner.username)]['state'] = user_1_state homecoming info def check_match(user1, user2): match_score = {} first_info = edu_info(user1) dict = edu_info(user2) item in dict: cities = dict[item]['cities'] #user2 = item #print cities city in cities: if city in first_info['jmitchel3']['cities']: match_score['user'] = 'jmitchel3' match_score['user2'] = str(user2.user.username) match_score['city'] = city print "here! " + str(city) else: print "not here! " + str(city) homecoming match_score check_match(j,t)

how this?

start function collects info single user, , returns single dictionary user:

def edu_info(user1): user_1_cities = [] user_1_schools = [] user_1_state = [] first_one = education.objects.filter(owner=user1) in first_one: user_1_cities.append(str(i.city)) user_1_schools.append(str(i.school)) user_1_state.append(str(i.state)) info = {} info['cities'] = user_1_cities info['schools'] = user_1_schools info['states'] = user_1_state homecoming info

then, have separate function calls info collecting function 1 time each of 2 users, , computing number of points information.

def check_match(user_1, user_2) info_1 = edu_info(user_1) info_2 = edu_info(user_2) school_points = similarity_points(info_1["schools"], info_2["schools"], 10) city_points = similarity_points(info_1["cities"], info_2["cities"], 5) state_points = similarity_points(info_1["states"], info_2["states"], 2) homecoming school_points + city_points + state_points

the meat of check_match function offloaded it's own helper function. function finds intersection of 2 lists of attributes, , multiplies number of shared attributes point value. converting attribute lists sets , using set intersection operator.

so, similarity_points(["mn","or","pa", "nj"],["az","nj","pa"], 2) find 2 matches (nj , pa) , homecoming 4.

def similarity_points(attr_1, attr_2, points) """award number of points each shared attribute. attr_1 , attr_2 should lists compare. """ number_shared = len(set(attr_1) & set(attr_2)) homecoming number_shared * points

then, can phone call above code like:

wilduck_jmitchel3_points = check_match("wilduck", "jmitchel3")

python django

android - text color passes to recycled list items in my adapter -



android - text color passes to recycled list items in my adapter -

i'm trying alter text colour of textview within listitem if text number under 5. when scroll / down, colours apply recycled items. i've looked around , don't understand how these recycled items work.

fragment class

listadapter adapter = new racesadapter(getactivity(), raceslist, r.layout.list_item, new string[] { tag_name, tag_goal, tag_numentrants }, new int[] { r.id.gamelabel, r.id.goallabel, r.id.entrantslabel}); setlistadapter(adapter);

racesadapter class (is modified simpleadapter) (look in bindview() code)

public view getview(int position, view convertview, viewgroup parent) { homecoming createviewfromresource(position, convertview, parent, mresource); } private view createviewfromresource(int position, view convertview, viewgroup parent, int resource) { view v; if (convertview == null) { v = minflater.inflate(resource, parent, false); } else { v = convertview; } bindview(position, v); homecoming v; } public void setdropdownviewresource(int resource) { this.mdropdownresource = resource; } @override public view getdropdownview(int position, view convertview, viewgroup parent) { homecoming createviewfromresource(position, convertview, parent, mdropdownresource); } @suppresswarnings("rawtypes") private void bindview(int position, view view) { final map dataset = mdata.get(position); if (dataset == null) { return; } final string[] = mfrom; final int[] = mto; final int len = to.length; (int = 0; < len; i++) { final view v = view.findviewbyid(to[i]); if (v != null) { final object info = dataset.get(from[i]); string text = info == null ? "" : data.tostring(); if (text == null) { text = ""; } boolean bound = false; if (mviewbinder != null) { bound = mviewbinder.setviewvalue(v, data, text); } if (!bound) { if (v instanceof textview) { if(v.getid()==r.id.entrantslabel){ if(integer.parseint(text) < 5){((textview) v).settextcolor(color.red);} } setviewtext((textview) v, text); } else if (v instanceof imageview) { if (data instanceof integer) { setviewimage((imageview) v, (integer) data); } else { setviewimage((imageview) v, text); } } else { throw new illegalstateexception(v.getclass().getname() + " not " + " view can bounds simpleadapter"); } } } } } public viewbinder getviewbinder() { homecoming mviewbinder; }

what should is, in bindview(), set text color default. then, may or may not alter color.red. if does, it's red, otherwise, it's default.

so, this:

private void bindview(int position, view view) { // ... (int = 0; < len; i++) { final view v = view.findviewbyid(to[i]); if (v != null) { v.settextcolor(color.black); // illustration // ... if (!bound) { if (v instanceof textview) { if(v.getid()==r.id.entrantslabel){ if(integer.parseint(text) < 5){((textview) v).settextcolor(color.red);} } // ... } // ... } } } }

android android-listview android-textview simplecursoradapter

c# - Response.End() generates an error when exporting gridview to excel file -



c# - Response.End() generates an error when exporting gridview to excel file -

i have code:

protected void ibtgeneratereport_click(object sender, imageclickeventargs e) { string filename = "report.xls"; stringwriter stringwriter = new stringwriter(); htmltextwriter htmlwrite = new htmltextwriter(stringwriter); datagrid datagrd = new datagrid(); datagrd.datasource = odslsraudit; datagrd.databind(); datagrd.rendercontrol(htmlwrite); system.io.streamwriter vw = new system.io.streamwriter(filename, true); stringwriter.tostring().normalize(); vw.write(stringwriter.tostring()); vw.flush(); vw.close(); writeattachment(filename, "application/vnd.ms-excel", stringwriter.tostring()); } public static void writeattachment(string filename, string filetype, string content) { httpresponse response = system.web.httpcontext.current.response; response.clearheaders(); response.appendheader("content-disposition", "attachment; filename=" + filename); response.contenttype = filetype; response.write(content); response.end(); }

but response.end() gives me below error:

microsoft jscript runtime error: sys.webforms.pagerequestmanagerparsererrorexception: message received server not parsed. mutual causes error when response modified calls response.write(), response filters, httpmodules, or server trace enabled. details: error parsing near '<table cellspacing="'.

the response.write(content) has right info can see. no save/open dialog box appear, besides above error.

i'm using updatepanels.

add page_load() method

assuming ibtgeneratereport button

protected void page_load(object sender, eventargs e) { scriptmanager scriptmanager = scriptmanager.getcurrent(this.page); scriptmanager.registerpostbackcontrol(this.ibtgeneratereport); //further code goes here.... }

explanation:

the updatepanel command uses asynchronous postbacks command parts of page rendered. using whole bunch of javascript on client , whole bunch of c# on server. rendered out using special format javascript on client can understand. if mess format rendering things outside of render phase of page, format messed up.

why keeping getting pagerequestmanagerparsererrorexception?

well, chances you're doing 1 of things mentioned in error message. here mutual reasons , why don't work:

calls response.write(): calling response.write() straight bypassing normal rendering mechanism of asp.net controls. bits write going straight out client without farther processing.

response filters /httpmodules : similar response.write(), can alter rendering in such way updatepanel won't know.

server trace enabled: trace written out using response.write(), , such messes special format utilize updatepanel.

calls server.transfer(): unfortunately, there's no way observe server.transfer() called. means updatepanel can't intelligent when calls server.transfer(). response sent client html markup page transferred. since html , not special format, can't parsed, , error.

solution: 1 way avoid parse error regular postback instead of asynchronous postback calling scriptmanager.registerpostbackcontrol()

please refer finish explanation , other solutions ellon lipton's blog here

c# asp.net gridview export-to-excel

google app engine - GWT - RPC Failure with GAE - Working in local on Greetings sample -



google app engine - GWT - RPC Failure with GAE - Working in local on Greetings sample -

i'm encountering probem gwt app. working great in local got error 500 when application deployed on google app engine.

to understand problem, tried deploy sample web application illustration greetings service , still got same error remote procedure phone call - failure.

i think it's coming ide settings can't figure out problem. can help ?

the problem facing only servlet paths .

the environment , folder construction cmpletely different in dev-mode , deployment environment .

in below link ,explained problem facing.

eclipse gwt sample greeting project rpc failure .

google-app-engine servlets rpc

How to correctly use XML attributes when using XSLT -



How to correctly use XML attributes when using XSLT -

i made xml file illustration of here:

<flight flightid="1"> <flightno>ek98</flightno> <callsign>uae98</callsign> <airline>emirates airline</airline> <altitude height="feet">41000 feet</altitude> <speed ratio="mph">564 mph</speed> <plane planeid="1"> <name>airbus 330</name> <speed>567 mph</speed> <wingspan>199 ft 11 in</wingspan> <length>301 ft 7 in</length> <registereddate>07-06-10</registereddate> </plane> <route> <routename>fiumicino-dubai</routename> <course bearing="degrees">154 degrees</course> <distance unit="miles">2697 miles</distance> <duration>pt5h30m</duration> <from> <iatacode>fco</iatacode> <airport>fiumicino</airport> <country>italy</country> <city>rome</city> <latitude>41.8044</latitude> <longitude>12.2508</longitude> <yahoowoeid>715520</yahoowoeid> </from> <to> <iatacode>dxb</iatacode> <airport>dubai intl</airport> <country>uae</country> <city>dubai</city> <latitude>25.2528</latitude> <longitude>55.3644</longitude> <yahoowoeid>1940345</yahoowoeid> </to> </route> </flight>

in distance element can see unit miles:

<distance unit="miles">2697 miles</distance>

in text have written miles, felt point in attributes can utilize , output value of attribute alongside value in distance? here sample of xsl distance used , effort @ adding units:

<tr> <td><xsl:attribute name="class">lside</xsl:attribute>distance</td> <td colspan="2"><xsl:attribute name="class">rside</xsl:attribute><xsl:value-of select="/flights/flight/route[routename/. ="fiumicino-dubai"]/distance"/><xsl:value-of select="@unit" /></td> </tr>

while inquire question, initial intention right way utilize attributes, why attributes exist, create global type of measurement same?

an attribute short form of element-value pair in xml document. <distance unit="miles">2697 miles</distance> same writing following:

<distance> <unit> <value>miles</value> </unit> <value>2697</value> </distance>

yes, using element attribute correctly in above xml. may take form xml document anyway wish--and hence pull info of such accordingly.

transfering reply in comments below answer:

to access value of element specific attribute using xpath, utilize below distinguish:

"/flights/flight/route[routename/. ="fiumicino-dubai"]/distance/@unit=@miles

xml xslt xpath

errno - IOCTL call and checking return value -



errno - IOCTL call and checking return value -

if((err = ioctl(fd, ioc_card_lock, &lock)) < 0) { printf("ioctl failed , returned errno %d \n",err); }

is above code right , programming practice? compile on pc. i.e populate err homecoming value of ioctl , check if err < 0

is above method standard way homecoming "err" returned ioctl.

there seem standard variable called errno? it? same above?

i found out improve way this.

if(ioctl(fd, ioc_card_lock, &lock) < 0) { printf("ioctl failed , returned errno %s \n",strerror(errno)); }

errno global variable set scheme calls.and strerror converts code (a negative integer) meaningful string ("invalid argument" example.)

ioctl errno

video.js - Video muted by default / Enable audio on fullscreen view only -



video.js - Video muted by default / Enable audio on fullscreen view only -

i read entire api , dozens of related help topics dont manage code help me want.

this need: video muted default. when user click on fullscreen button video played total volume.

how code this?

i understand can mute video adding myplayer.volume(0) this:

<script> var myplayer = _v_("video_1"); myplayer.volume(0); </script>

but how observe whether video in fullscreen or not? found fullscreenchange event on api dont manage implement successfully. help day. give thanks you!

listen fullscreenchange event , check isfullscreen property of player.

var myplayer = _v_("video_1"); myplayer.volume(0); var onfullscreen = function(){ if (this.isfullscreen) { this.volume(1); } else { this.volume(0); } }; myplayer.addevent("fullscreenchange", onfullscreen);

https://github.com/zencoder/video-js/blob/master/docs/api.md

video.js

c# - Get Video from webcam / Ip-camera -



c# - Get Video from webcam / Ip-camera -

i'm trying implement photographic camera security in application. got sdk's security companys implement there scheme utilize activex. view right activex kinda old?

but newest way video devices , display (stream) them on screen? command utilize in .net 4.5 wpf (and windows 8)

i'm working on video wpf app 2 years , had fundamental problem video , wpf never resolved, , that's variable fps-rate. blog post goes details.

there's nice library called media kit (by jeremiah morrill), might suitable problem.

in our solution had no selection expose hwnd's our rendering directx engine. accomplished using hwndhost class , extending our custom wpf control. note base of operations class windows forms host, same amount of problems winforms-wpf inter op.

also, activex way display professional photographic camera video streams in web interfaces, it's still defacto industry standard, you'll moxa, acti, vivotek , various other photographic camera equipment manufactureres.

one more thing, if need perform advanced analysis of video, i'd suggest opencv.

c# wpf video-streaming .net-4.5 video-capture

javascript - Disable zoom/lens on UIWebview without disabling user selection -



javascript - Disable zoom/lens on UIWebview without disabling user selection -

i disable zoom/lens on uiwebview. but, not want of user selection disabled in process i.e. cannot utilize next in css.

-webkit-user-select:none

if have access uiwebview can following: '[mywebview setscalespagetofit:no]'

this disable zooming in web view.

source

javascript ios css uiwebview

perl - How can I clear all cached objects using Cache::FileCache? -



perl - How can I clear all cached objects using Cache::FileCache? -

i using cache::filecache , cache stored in /tmp/filecache/

in /tmp/filecache/ there 3 dirs:

__auto_purge__ default namespace

which 1 safe deletes clear cache?

cache::filecache implements cache::cache interface.

instead of messing straight filesystem, might want write short script such as

use strict; utilize warnings; utilize cache::filecache; $cache = cache::filecache->new( {namespace => 'whatever namespace using'} ); $cache->clear; # or clear remove objects caches of type.

perl mod-perl

windows phone 7 - how to read resources from app.xml -



windows phone 7 - how to read resources from app.xml -

i defined resources in app.xml

<application.resources> <maps:mapglobalsettings x:key="mapglobalsettings" apikey="1234567890" /> </application.resources>

how can read code?

you can read global resources like

app.current.resources["mapglobalsettings"]

it returns object, have cast original type

windows-phone-7

java - How to make Maven checking the source end-of-line? -



java - How to make Maven checking the source end-of-line? -

i enforce unix style end-of-line (\n) in java sources of our projects consistency reasons. many of work under windows, ides configured default utilize windows style end-of-line (\r\n). seek alter settings each time configure new workspace reasons, files commited windows end-of-line.

is there maven configuration or plugin help enforcing unix style end-of-line or, @ least, warning of files in windows style?

i though pmd or checkstyle first doesn't appear simple. i've checked maven enforcer plugin don't think out-of-the box. should able create own rule i'd create sure don't reinvent wheel :)

use checkstyle, used in our project enforce unix line endings.

you can utilize regular look ( windows line ending \r\n, know that).

java maven coding-style end-of-line dos2unix

z3 - getting new unsat cores -



z3 - getting new unsat cores -

there

i trying extract clause formulas , alter 1 clause's polarity every time, if solved sat, computing models , set clause in set. if solved unsat, find out new unsat cores. incrementally calling unsat core function, it's solved unsat, solver cannot give new unsat cores. codes below:

context c; expr x = c.int_const("x"); expr y = c.int_const("y"); solver s(c); expr f = x + y > 10 && x + y < 6 && y < 5 && x > 0; assert(f.is_app()); vector<expr> qs; if (f.decl().decl_kind() == z3_op_and) { std::cout << "f num. args (before simplify): " << f.num_args() << "\n"; f = f.simplify(); std::cout << "f num. args (after simplify): " << f.num_args() << "\n"; (unsigned = 0; < f.num_args(); i++) { std::cout << "creating reply literal q" << << " " << f.arg(i) << "\n"; std::stringstream qname; qname << "q" << i; expr qi = c.bool_const(qname.str().c_str()); // create new reply literal s.add(implies(qi, f.arg(i))); qs.push_back(qi); } } qs.clear(); vector<expr> f,c,m; size_t count = 0; for(unsigned i=0; i<f.num_args(); i++){ f.push_back(f.arg(i)); } while(!f.empty() && count != f.num_args()){ c.push_back(f[0]); f.erase(f.begin(),f.begin() +1); if(m.size()){ for(unsigned i=0; i<f.size();i++){ s.add(f[i]); } for(unsigned j=0; j<m.size(); j++){ s.add(m[j]); } expr notc= to_expr(c, z3_mk_not(c,c[count])); s.add(notc); }else{ expr notc = to_expr(c,z3_mk_not(c,c[count])); s.add(notc); for(unsigned =0; i<f.size(); i++){ s.add(f[i]); } } if(s.check() == sat){ cout<<"sat"<<"\n"; m.push_back(c[count]); }else if(s.check() == unsat){ size_t i; i=0; if(f.size()){ for(unsigned w=0; w<f.size(); w++){ std::stringstream qname; expr qi = c.bool_const(qname.str().c_str()); s.add(implies(qi,f[w])); qs.push_back(qi); i++; } } for(unsigned j=0; j<m.size(); j++){ stringstream qname; expr qi = c.bool_const(qname.str().c_str()); s.add(implies(qi,m[j])); qs.push_back(qi); i++; } std::stringstream qname; expr qi = c.bool_const(qname.str().c_str()); expr notc = to_expr(c,z3_mk_not(c,c[count])); s.add(implies(qi,notc)); if(s.check(qs.size(),&qs[0]) == unsat){ expr_vector core2 = s.unsat_core(); cout<<"new cores'size "<<core2.size()<<endl; cout<<"new cores "<<core2<<endl; } } qs.clear(); count++; }

it's unclear question is, i'm guessing extract multiple different unsat cores same formula. z3 not back upwards out of box, algorithms can implemented on top of it. see previous question , reference given there (algorithms computing minimal unsatisfiable subsets of constraints), explains basics behind core minimization.

z3

javascript - Reduce and Sum Array positions -



javascript - Reduce and Sum Array positions -

lets have array:

var likes = [4,7,3,11,3,73,78,34,7,13];

however, i'm capable of utilize length of 5 due restrictions. want "convert" array lenght of 5, , sum other positions, distribute them equally.

does have clue how can this?

maybe solve problem:

var likes = [4,7,3,11,3,73,78,34,7,13], result_array = [ ]; for(var = 0; < likes.length; i++) { if(i % 2) { var new_val = likes[i - 1] + likes[i]; result_array.push(new_val); } }

see working jsfiddle here.

this cause new array contain [ 11, 14, 76, 112, 20 ], , increment in length when new values added initial array.

javascript

c++ - How can I call a function or statically initialize an object immediately before main? -



c++ - How can I call a function or statically initialize an object immediately before main? -

in short, particular piece of static initialization occur close origin of main()/dllmain() possible. acceptable constructor called lastly during static initialization.

since compiler-specific implementation, i'm looking using visual c++ compiler (vs 2010 , beyond). in future need in gcc , clang, that's not immediate concern.

the long story have object in base of operations library statically initialized , creates thread in constructor. thread relies on other statically initialized objects in libraries don't command causes race status in static initialization. if can pause or avoid creating thread until other static initialization finish should prepare problem (a simple sleep(5000) avoids issue, though that's not robust solution).

i explicitly phone call initialize function in our main() function, isn't ideal have 20+ binaries utilize library every programmer have remember run initialization in every binary. prefer force responsibility compiler if possible.

the comment of refugnic eternium above correct, , offers 1 solution.

the best solution have function this:

bool initmylib();

all functions in mylib.dll, , all constructors, should fail until has been called. way can ensure programmers don't forget phone call it.

c++ visual-c++ main static-initialization

java ee - Eclipse add Tomcat 7 blank server name -



java ee - Eclipse add Tomcat 7 blank server name -

i trying add together tomcat 7 in eclipse in ubuntu. when click "add new server" in eclipse , select "tomcat v7.0 server", field "server name" blank , cannot type in in textbox shown below:

what did before deleted tomcat 7 server eclipse , trying reinstall tomcat 7. doesn't allow me type in textbox , cannot proceed "next" button. environment ubuntu linux , eclipse javaee.

it bug in eclipse. had same problem, on ubuntu eclipse java ee juno.

here workaround worked me:

close eclipse in {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings delete next 2 files: org.eclipse.wst.server.core.prefs org.eclipse.jst.server.tomcat.core.prefs restart eclipse

source: eclipse.org forum

eclipse java-ee tomcat

styled maps with Subgurim Google Maps -



styled maps with Subgurim Google Maps -

it possible create styled map subgurim google map control?

here code in according google api v3.

var styles = [{ featuretype: "all", elementtype: "all", stylers: [ { saturation: -100 } ] }]; map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); var maptype = new google.maps.styledmaptype(styles); map.maptypes.set("mymap", maptype); map.setmaptypeid("mymap");

i'm 1 of developers of subgurim maps , feature available in our next version, before end of month. have i'll inform through question.

subgurim-maps

ruby on rails - Postgres throws error when running import from activerecord-import gem -



ruby on rails - Postgres throws error when running import from activerecord-import gem -

i switched postgres in development , next error breaks test case:

pg::error: error: column "id" of relation "assets_content_nodes" not exist : select pg_get_serial_sequence($1, $2)

same error happens in development , production environments not show stopper , not impact import. assets_content_nodes bring together table , i'd rather not add together 'id' column. ideas why may happening?

this fixed in activerecord-import -v0.3.1 (or perchance before version, broken in 0.2.11 , earlier). no longer need id column on table import.

ruby-on-rails postgresql activerecord-import

Unable to receive reply at Java client from C++ server -



Unable to receive reply at Java client from C++ server -

i'm trying first zmq example. client java , server c++. i've been able send message client server, reply doesn't reach client.

server code:

while (true) { zmq::message_t request; // wait next request client socket.recv (&request); std::cout << "received hello" << std::endl; // 'work' sleep (1); // send reply client zmq::message_t reply (5); memcpy ((void *) reply.data (), "world", 5); std::cout << "sending world" << std::endl; socket.send (reply); }

client code:

for (int request_nbr = 0; request_nbr != 10; request_nbr++) { // create "hello" message. // ensure lastly byte of our "hello" message 0 because // our "hello world" server expecting 0-terminated string: string requeststring = "hello" + " "; byte[] request = requeststring.getbytes(); request[request.length - 1] = 0; // sets lastly byte 0 // send message system.out.println("sending request " + request_nbr + "\u2026"); socket.send(request, 0); system.out.println("waiting reply " + request_nbr + "\u2026"); // reply. byte[] reply = socket.recv(0); // when displaying reply string, omit lastly byte because // our "hello world" server has sent 0-terminated string: system.out.println("received reply " + request_nbr + ": [" + new string(reply, 0, reply.length - 1) + "]"); }

output:

bound. waiting client.. received hello sending world

java c++ zeromq

Cant host content with amazon ec2 -



Cant host content with amazon ec2 -

here have done:

i've opened post 80, 22,21 in amazon e2 security settings

i have putty , putty gen

i have putty , pem keys

i created index.html file in public_html directory using win_scp

nothing loads

http://ec2-107-20-57-133.compute-1.amazonaws.com/

putty keeps telling me connection refuses no matter set in it. can't login without disconnecting me. problem own network setting @ work , problem putty config, problem amazon account..i dunno

first, ip addresses did allow http, ftp , ssh traffic from?

next, ec2-107-20-57-133.compute-1.amazonaws.com still right instance name?

then, web started , running? index.html actual default document?

amazon-web-services amazon-ec2 cloud

java - How do you properly use the compareTo method implemented in String? -



java - How do you properly use the compareTo method implemented in String? -

so created employee object , driver. driver contains arraylist of employees, , particular method returns employee name comes first alphabetically.

let's add together 2 employees arraylist 'staff' , phone call them "a" , "z".

for reason, returns employee "z" when expect homecoming employee "a". using compareto method correctly, or else entirely?

public employee first() { int guy = 0; ( int x = 1 ; x < staff.size() ; x ++ ) { if ( staff.get( x -1 ) instanceof employee && staff.get( x - 1 ).getname().compareto( staff.get( x ).getname() ) < 0 ) guy = x - 1; } homecoming ( (employee) staff.get( guy ) ); }

no need reinvent wheel. create utilize of custom comparator , utilize collections sorting methods.

public class namecomparator implements comparator<employee> { @override public int compare(employee o1, employee o2) { homecoming o1.getname().compareto(o2.getname()); } } collections.sort(yourarraylist, new namecomparator());

alternatively, can ensure employee class implements comparable<employee> , can without custom comparator above. assumes ever want compare based on names.

java string compareto

google app engine - Eclipse hangs during creation of cloud endpoints -



google app engine - Eclipse hangs during creation of cloud endpoints -

i using latest google plugin eclipse (1.7.5) when ever seek create app engine connected android project, eclipse hangs during "generation of cloud endpoint library"

same case when create google app engine project , manually create endpoints.

is there workaround problem ?

eclipse google-app-engine google-cloud-endpoints google-plugin-eclipse

c# - Binding dynamic text with image in one column and Select entier column in datagrid of wpf -



c# - Binding dynamic text with image in one column and Select entier column in datagrid of wpf -

please allow me know how perform kind of functionality wpf datagrid.

and allow utilize know how select entire column of datagrid of wpf.

http://www.codeproject.com/articles/30905/wpf-datagrid-practical-examples helps work around datagrid.

c# wpf data-binding datagrid wpfdatagrid

clojure - error while using nrepl-jack-in -



clojure - error while using nrepl-jack-in -

i getting below error whenever seek m-x nrepl-jack-in -

error in process sentinel: not start nrepl server: /usr/bin/lein: line 260: java: command not found

i able start repl without issues lein repl or lein2 repl - both work.

thanks, murtaza

you may have different environment within emacs within shell. java installed in same place lein? if type m-x shell, , run java -help there work? "m-x shell-command java -help"

clojure

need to categorize wordpress posts into subfolders without individually installing wordpress in subfolders -



need to categorize wordpress posts into subfolders without individually installing wordpress in subfolders -

i working on wordpress site related sports. posts @ same place categorized football, tennis, etc. want alter construction of blog, such football, should domain.com/football , tennis, should domain.com/tennis , on. 1 way install wordpress in subfolders , import categorized posts, result in maintaining multiple wordpress websites. there way or wordpress plugin can same, using 1 wordpress site? thanks. utilize cpanel.

p.s. well, not necessary subfolder, need address bar showing domain.com/*sports_name* in it. thanks.

you go settings -> permalinks , set custom permalink construction of /%category%/%postname%/

then create categories such 'tennis' , 'football' , add together posts relevant categories.

the codex entry on permalinks here - http://codex.wordpress.org/using_permalinks

in times gone permalink construction wasn't recommended big blogs due performance reasons understanding (bracing downvotes!) that no longer case.

wordpress wordpress-plugin cpanel subfolder

What Is The Better Way To Customize A Core Block's After Prepare Layout in Magento? -



What Is The Better Way To Customize A Core Block's After Prepare Layout in Magento? -

all blocks in magento inherit abstract, , within fragment of code:

#file: app/code/core/mage/core/block/abstract.php   public function setlayout(mage_core_model_layout $layout) {     $this->_layout = $layout;     mage::dispatchevent('core_block_abstract_prepare_layout_before', array('block' => $this));     $this->_preparelayout();     mage::dispatchevent('core_block_abstract_prepare_layout_after', array('block' => $this));     return $this; }

there 2 ways hook onto prepare layout of core block:

rewrite core block own , create _preparelayout function calling it's parent , doing code after observe core_block_abstract_prepare_layout_after event , check if instance of block 1 interested in

the advantage sec event/observer patterns better, more stable selection implementing additional functionality. however, disadvantage observer have run every single block layout prepared.

which improve progamming technique here?

if rewrite abstract class block still utilize 1 in core, because straight extend , don't utilize magento rewrite rules. sec solution. observer on every block performance issue should not big, because in cases execute simple status instanceof, fast.

magento

coldfusion - WriteOutput doesn't produce carriage return line feed in the html source -



coldfusion - WriteOutput doesn't produce carriage return line feed in the html source -

this beingness picky, hey... if utilize writeoutput command in cfscript, doesn't set carriage return/line feed in output.

q: there writeoutputln() or that?

right now, manually add together chr(13) & chr(10) format source code pretty.

it doesn't create sense have writeoutputln() function in language output targeted @ browser, , crlfs don't render in browser, point be? 1 "ok, set <br> there instead". makes no utilize situations other when outputing mark-up. , should <br> or <br/>? or <br />? that's picky, goes show there's no realy single equivalent "correct" behaviour.

that , writing udf simple - , can finetuned situation it's used in - there's no point.

i reckon answers question why it's not in language.

coldfusion coldfusion-9

java ee - How to implement connection-pooling efficiently? -



java ee - How to implement connection-pooling efficiently? -

my code connect database using basicdatasource following, referring ans suppose code creates physical connection database 1 time , provide pool connections afterward. question that, code provide pool connection?, if does, should maintain connection section of code in next method or in constructor provide efficient pooling ? , how should annotations state of class ? @stateful?

// connection section start basicdatasource bs = new basicdatasource(); preparedstatement ps = null; connection con = null; seek { bs.setdriverclassname("com.mysql.jdbc.driver"); bs.seturl("jdbc:mysql://localhost/mydb"); bs.setusername("root"); bs.setpassword(""); con = bs.getconnection(); system.out.println("connecting"); // connection section end ps = con.preparestatement("select *" + " client username = ? "); ps.setstring(1, username); resultset r = ps.executequery(); if (r.next()) { con.close(); homecoming "true"; }

basicdatasource implements connection pooling. however, if create new pool each time it's useless. create info source 1 time , reuse everywhere.

usually, in java ee inject info source. is, container manages info source you. injecting datasource in bean simple as

@resource private datasource moviedatabase;

see this example. configuring datasource depends on container using, though. same info source can used stateful , statless beans.

java-ee jdbc datasource connection-pooling

css - How to show arraylist of Strings in p:dataGrid? -



css - How to show arraylist of Strings in p:dataGrid? -

i have ajax functionality add together names , show on same page in table manner 1 image(on left of text) , 1 "x" image(on right delete). should added like, left right , after completing 1 row, should start next row.

so need show arraylist of string in p:datagrid or other tag can used same functionality.

i tried combination of ui:repeat , p:panelgrid unable datagrid funtionallty. did not used p:datatable because add together new element on bottom side not need.

p.s.

<h:form> <h:selectonemenu id="recepients" value="#{controller.selected}"> <f:selectitem itemlabel="select" itemvalue=""></f:selectitem> <f:selectitem itemlabel="info1" itemvalue="info1"></f:selectitem> <f:selectitem itemlabel="info2" itemvalue="info2"></f:selectitem> <f:selectitem itemlabel="info3" itemvalue="info3"></f:selectitem> <f:selectitem itemlabel="info4" itemvalue="info4"></f:selectitem> <f:selectitem itemlabel="info5" itemvalue="info5"></f:selectitem> </h:selectonemenu> <p:commandbutton value="add" action="#{controller.submit}" update="nameslist" /> <p:datagrid id="nameslist" value="#{controller.tempnamelist}" var="name" columns="3"> <p:column> <p:outputlabel value="%" /> </p:column> <p:column> <p:outputlabel value="#{name}" /> </p:column> <p:column> <p:commandlink value="x" action="#{controller.delete(name)}" update="nameslist"> </p:commandlink> </p:column> </p:datagrid> </h:form>

the result should this...

% abc x % xyz x % dfd x

plz consider % image , x close symbol

the <p:datagrid> doesn't back upwards <p:column>. column layout applicable <p:datatable>.

replace <p:column> single grouping component, e.g. <h:panelgroup> or maybe <p:panel>, shown on showcase site.

<p:datagrid id="nameslist" value="#{controller.tempnamelist}" var="name" columns="3"> <h:panelgroup> <p:outputlabel value="%" /> <p:outputlabel value="#{name}" /> <p:commandlink value="x" action="#{controller.delete(name)}" update="nameslist" /> </h:panelgroup> </p:datagrid>

css jsf datagrid primefaces panel

mysql - Get all actions of the last three users -



mysql - Get all actions of the last three users -

i have history table stores actions done users on deferments posts

id | post_id | action | user_id 1 | 5 | 1 | 3 2 | 6 | 4 | 1 3 | 6 | 4 | 4 4 | 7 | 2 | 6 5 | 7 | 3 | 2 6 | 5 | 2 | 3 7 | 4 | 5 | 3

what want actions done lastly 3 users

assuming id auto_increment column,

select a.user_id, a.action tablename inner bring together ( select distinct user_id tablename order id desc limit 3 ) b on user_id = b.user_id sqlfiddle demo

mysql sql

ruby - Rails update_attributes not updating record -



ruby - Rails update_attributes not updating record -

i have next code in "entries_controller.rb"

def update @entry = entry.find(params[:id]) puts "received http request update old entry:#{@entry.inspect} with" puts "new parameters: #{params}" if @entry.update_attributes(params[:entry]) puts"update successful" @entry2 = entry.find(params[:id]) puts "here new value #{@entry2.inspect}" end end

when send set request server client console shows this:

2013-02-17t20:12:25+00:00 app[web.1]: received http request update old entry:#<entry id: 1, created_at: "2013-02-17 19:17:40", updated_at: "2013-02-17 19:17:40", description: "test", title: "home", category: "-1", latitude: "49.258061", longitude: "-123.153972", hasphoto: false> 2013-02-17t20:12:25+00:00 app[web.1]: new parameters: {"description"=>"test", "id"=>"1", "category"=>"-1", "hasphoto"=>"0", "latitude"=>"49.258061", "longitude"=>"-123.153972", "title"=>"updated home", "action"=>"update", "controller"=>"entries", "format"=>"json"} 2013-02-17t20:12:25+00:00 app[web.1]: update successful 2013-02-17t20:12:25+00:00 app[web.1]: here new value #<entry id: 1, created_at: "2013-02-17 19:17:40", updated_at: "2013-02-17 19:17:40", description: "test", title: "home", category: "-1", latitude: "49.258061", longitude: "-123.153972", hasphoto: false>

as can see old record not updated. though if clause evaluated true. see value "title" didn't alter "home" "updated home".

im wondering whats bug in this? saying updated didn't update.

can help me understand please?

thanks

what's happening within view file not setting appropriate form in view. parameters returning this

{"description"=>"test", "id"=>"1", "category"=>"-1", "hasphoto"=>"0", "latitude"=>"49.258061", "longitude"=>"-123.153972", "title"=>"updated home", "action"=>"update", "controller"=>"entries", "format"=>"json"}

when in reality should returning this...

{"entry" => {"description"=>"test", "id"=>"1", "category"=>"-1", "hasphoto"=>"0", "latitude"=>"49.258061", "longitude"=>"-123.153972", "title"=>"updated home"}, "action"=>"update", "controller"=>"entries", "format"=>"json"}

notice difference? parameters regarding entry wrapped , attached attribute entry. way when rails looks @ parameters, knows parameters newly updated entry. without looking @ forms, there isn't way tell how prepare it, here's place start.

ruby-on-rails ruby http-post update-attributes

winapi - c - merging two text files -



winapi - c - merging two text files -

say have 2 text files:

a.txt:

param1: value1 param2: value2 . . . . paramm: valuem

b.txt

param1: value1 param2: value2 . . . . paramn: valuen number of parameters in a.txt, i.e. m can greater than, lesser or equal number of parameters in b.txt, i.e. n. values same parameter need not same in a.txt , b.txt. m , n can reach maximum value of 200. the parameter names arbitrary. have no numbers. above illustration.

my objective merge a.txt , b.txt. if conflicts occur, have file/in-memory storage dictates 1 takes precedence.

for example,

a.txt like:

path: c:\program\files data: importantinfo.dat version: 1.2.3 useless: uselessparameter.txt

and

b.txt like:

path: c:\programfiles data: notsoimportant.dat version: 1.0.0 useful: usefulparameter.txt

the final text file should like:

path: c:\programfiles data: importantinfo.dat version: 1.2.3 useful: usefulparameter.txt

now approach thinking is:

get line a.txt line b.txt tokenize both ":" compare param names if same write a.txt's value result.txt else if different write a.txt's line result.txt write b.txt's line result.txt /* order doesn't matter */ repeat above steps until end of both text files

this approach doesn't take care of when a.txt has parameter , b.txt doesn't. extremely helpful if lightweight library/apis exist this. not looking command-line tools (thanks overhead of doing system() calls).

thanks!

this much easier in language has map datatyp. this:

read of b , store key-value strings in memory

read , each key either overwrite value (if exists) or add together (if doesn't)

output key-values file

c winapi file-io

linux - Parsing iostat output -



linux - Parsing iostat output -

the output of iostat that:

device: rrqm/s wrqm/s r/s w/s rkb/s wkb/s avgrq-sz avgqu-sz await svctm %util sda 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58 sda1 0.00 0.00 0.00 0.00 0.00 0.00 25.86 0.00 6.57 5.38 0.00 sda2 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58 sdb 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 30.37 20.16 0.00 vg00-logvol00 0.00 0.00 0.00 0.70 0.02 2.79 8.04 0.02 23.72 3.71 0.26 vg00-logvol04 0.00 0.00 0.00 4.31 0.03 17.26 8.01 0.07 16.74 4.32 1.87 vg00-logvol03 0.00 0.00 0.00 0.24 0.00 0.98 8.01 0.01 21.37 8.52 0.21 vg00-logvol08 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 14.03 2.31 0.00 vg00-logvol01 0.00 0.00 0.00 0.00 0.00 0.00 8.03 0.00 127.25 1.17 0.00 vg00-logvol07 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 2.42 1.72 0.00 vg00-logvol06 0.00 0.00 0.00 0.80 0.01 3.21 8.02 0.01 10.28 4.89 0.39 vg00-logvol02 0.00 0.00 0.01 0.26 0.10 1.04 8.52 0.01 52.88 6.01 0.16 vg00-logvol05 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 3.73 0.33 0.00

i seek parse output when reach "vg00-logvol00", "vg00-logvol04" have problems parsing text. there way remove lines using sed?

thank you

if vg00 nowadays in split lines, this:

sed '/vg00/ { n; s/\n// }'

with copy/pasted text have next aligns columns (gnu sed , bsd sed):

sed '/vg00/ { n; s/\n//; s/ \{5,\}/ /; }'

output:

device: rrqm/s wrqm/s r/s w/s rkb/s wkb/s avgrq-sz avgqu-sz await svctm %util sda 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58 sda1 0.00 0.00 0.00 0.00 0.00 0.00 25.86 0.00 6.57 5.38 0.00 sda2 0.00 2.40 0.01 3.92 0.16 25.28 12.95 0.05 12.81 6.58 2.58 sdb 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 30.37 20.16 0.00 vg00-logvol00 0.00 0.00 0.00 0.70 0.02 2.79 8.04 0.02 23.72 3.71 0.26 vg00-logvol04 0.00 0.00 0.00 4.31 0.03 17.26 8.01 0.07 16.74 4.32 1.87 vg00-logvol03 0.00 0.00 0.00 0.24 0.00 0.98 8.01 0.01 21.37 8.52 0.21 vg00-logvol08 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 14.03 2.31 0.00 vg00-logvol01 0.00 0.00 0.00 0.00 0.00 0.00 8.03 0.00 127.25 1.17 0.00 vg00-logvol07 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 2.42 1.72 0.00 vg00-logvol06 0.00 0.00 0.00 0.80 0.01 3.21 8.02 0.01 10.28 4.89 0.39 vg00-logvol02 0.00 0.00 0.01 0.26 0.10 1.04 8.52 0.01 52.88 6.01 0.16 vg00-logvol05 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 3.73 0.33 0.00

linux parsing sed iostat

IN query in MYSQL Function -



IN query in MYSQL Function -

i m in situation need pass comma separated project ids stored procedure function

stored procedure

create procedure `spgetdata`( ) begin set session group_concat_max_len = 10000000; set @leadprojectids = (select distinct cast(group_concat(projectid separator ',') char(10000000)) project pr status = 2); select fncount(@leadprojectids) count; end

and function is

create function `fncount`( _projectids varchar(800) ) returns decimal(10,2) begin set @leadscount = (select count(*) project projectid in(_projectids)); homecoming @leadscount; end

but above function not homecoming count.

the sp , function mentioned here example, m using function info because has many more conditions , bring together mentioned here.

so want know, how can pass projectids 1,2,3,4 , result function in mysql.

try using instr function:

create function `fncount`( _projectids varchar(800) ) returns decimal(10,2) begin set @leadscount = (select count(*) project instr(_projectids, concat(',', projectid, ',')) > 0); homecoming @leadscount; end

just sure every projectid within _projectids parameter has format ,projectid,. additionally, aware there limit of project ids concatenated on string, blow @ point.

mysql

python - Matplotlib drawings not shown as non-root user -



python - Matplotlib drawings not shown as non-root user -

knowing question, 100times asked, no solution helps me.

trying create simple plot:

import matplotlib.pyplot p p.plot(range(20), range(20)) p.show()

i used several backends in ~/.matplotlib/matplotlibrc, such gtk, gtkagg, qt4agg, gdk, agg, svg, kairo,...), adding line

backend: <backend>

but nil happens when seek plot. no error message, nothing. used both standard console python2.7 , ipython console.

i'm using centos gnome desktop. matplotlib 1.2.0.

do have ideas?

note: realized problem non-root user.

python matplotlib

wifi - How to connect Android app to an static ip address -



wifi - How to connect Android app to an static ip address -

i trying develop app needs connect device via wifi. know ip address of other device, when seek connect it, not able.

private static string geturl(string direccion) throws connectexception{ seek { url u = new url("http://192.168.1.216"); httpurlconnection co = (httpurlconnection) u.openconnection(); bufferedreader reader = new bufferedreader(new inputstreamreader(co.getinputstream())); string line; while ((line = reader.readline()) != null) //buffer.append(line); system.out.println(line); reader.close(); co.disconnect(); system.out.println("######inputstream correcta... "+u); homecoming line; } grab (malformedurlexception e) { throw new connectexception(); } grab (java.net.connectexception e){ throw e; } grab (ioexception e) { throw new connectexception(); } }

you need specify these also:

co.setrequestmethod("get"); co.setdooutput(true); co.connect();

hence ,try :

private static string geturl(string direccion) throws connectexception{ seek { url u = new url("http://192.168.1.216"); httpurlconnection co = (httpurlconnection) u.openconnection(); co.setrequestmethod("get"); co.setdooutput(true); co.connect(); bufferedreader reader = new bufferedreader(new inputstreamreader(co.getinputstream())); string line; while ((line = reader.readline()) != null) //buffer.append(line); system.out.println(line); reader.close(); co.disconnect(); system.out.println("######inputstream correcta... "+u); homecoming line; } grab (malformedurlexception e) { throw new connectexception(); } grab (java.net.connectexception e){ throw e; } grab (ioexception e) { throw new connectexception(); }

}

android wifi ip-address connect

c# - logging: Is it acceptable to use try finally blocks for logging method start and end? -



c# - logging: Is it acceptable to use try finally blocks for logging method start and end? -

consider situation method lot of homecoming statements needs logged, rather doing,

if(condition1) { calculation here log homecoming } else if(condition2) { calculation here log homecoming b } else { calculation here log homecoming c }

if log statements same, improve log way?

try { if(condition1) { calculation here homecoming } else if(condition2) { calculation here homecoming b } else { calculation here homecoming c } } { log }

are there implications if create seek block logging? best practice?

why not homecoming @ end this

var returnvalue if(condition1) { calculation here returnvalue = } else if(condition2) { calculation here returnvalue = b } else { calculation here returnvalue = c } log homecoming returnvalue

c# java logging

orchardcms - Building a list of downloadable items in Orchard 1.6 -



orchardcms - Building a list of downloadable items in Orchard 1.6 -

i'm new orchard , i'm wondering "best" way of building basic list of documents download link?

say scenario this, want create list of newsletters, news letter in pdf format , users should able download straight list view. admin, should able add together new newsletter , should turn in list.

my current train of thought to, through dashboard,

create content type "newsletter" title field , media picker field, using media picker field upload pdf file. then create query, filter on content type "newsletter" create projection pointing query

however, gives me list of content items, showing title links actual content item.

i've tried adding layout query , set display properties instead of content. doing can list can command "output" bit more. , i've gotten list title , doing rewrite , putting in mediapicker.url, displays url in list. here stuck..

as mediapicker.url outputs url in format ~/media/default/xyz/filename.pdf, cant set a href, doesn't give right download link file.

soo, question is, thinking , doing totally wrong way or missing obvious? ideas , suggestions , more welcome.

use or adapt next template override in theme:

@{ var url = model.contentfield.url; } @if(model.contentfield.url != null) { if (url.startswith("~/")) { url = href(url); } <div class="media-picker-field attachment-pdf"> <a href="@url" class="pdf-download" title="@t("download pdf")"><span>download</span></a> </div> }

modify text needed. template fields.mediapicker-pdf.cshtml used media picker field named pdf.

orchardcms orchardcms-1.6

Parse a tcl word into a list of tcl commands ready for eval or uplevel -



Parse a tcl word into a list of tcl commands ready for eval or uplevel -

i want write function can used this:

my_function { cmda arga_1 arga_2 cmdb argb_1 argb_2 cmdc argc_1 argc_2 }

i want implement my_function using namespace eval ::my_internal_namespace [uplevel ...], perchance in loop. although not useful, enhance later more simply uplevel.

my_internal_namespace defined this:

namespace eval my_internal_namespace { proc cmda { args } { puts "$args" } proc cmdb { args } { puts "$args" } proc cmdc { args } { puts "$args" } }

i think technique allow caller of my_function declare facts , behaviours my_function, parameters of facts , behaviours evaluated in context of caller, example, value of variables or perform other substitutions in namespace , scope of caller.

why not pass word namespace eval directly? that's almost tcl in situations oo::define command. evaluate script wonderfully easy way parse trusted code.

namespace eval ::my_internal_namespace $the_user_word

for untrusted code, safe interpreter recommended. these “little language” approaches, you're best create basic safe interpreter, hide remaining commands don't want expose, , add together in aliases commands want create available.

set [interp create -safe] foreach cmd [$i eval {info commands}] { $i hide $cmd } foreach cmd {cmda cmdb cmdc} { $i alias $cmd ::my_internal_namespace::$cmd } $i eval $the_user_word

this expensive doing namespace eval; wouldn't bother if code relatively trusted.

tcl

objective c - Storing SegmentedControl Segment State in NSUserDefaults -



objective c - Storing SegmentedControl Segment State in NSUserDefaults -

i trying store segment index of segmentedcontrol in nsuserdefaults.

here code loading preferences , preferences 'save' button.

- (void)viewdidload { [super viewdidload]; // stored info before view loads nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; int yprefsegment = [defaults integerforkey:@"ypref"]; prefysegmentedcontrol.selectedsegmentindex = yprefsegment; } - (ibaction)saveprefbutton:(id)sender { int ypref = [[prefysegmentedcontrol.selectedsegmentindex] integervalue]; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults synchronize]; nslog(@"data saved"); }

i getting error on line (in saveprefbutton) :

int ypref = [[prefysegmentedcontrol.selectedsegmentindex] integervalue];

error is: expected identifier

i lost here. don't know talking about.

thank you.

you have 1 syntax error , 2 semantical errors.

the syntax error:

[prefysegmentedcontrol.selectedsegmentindex]

choose 1 of method phone call or dot notation accessing properties. utilize either

[prefysegmentedcontrol selectedsegmentindex]

or

prefysegmentedcontrol.selectedsegmentindex

the first semantical error:

prefysegmentedcontrol.selectedsegmentindex

is integer. no need phone call integervalue on it. (you can't send messages primitive types anyway. not smalltalk.)

the sec semantical error: don't store index in nsuserdefaults. insert

[defaults setinteger:ypref forkey:@"ypref"];

before synchronize user defaults.

objective-c nsuserdefaults

osx - Applescript broken in iTunes 11 -



osx - Applescript broken in iTunes 11 -

i found applescript http://www.ilounge.com/index.php/articles/comments/apple-tv-not-showing-descriptions/ worked in itunes previously, not seem work in itunes 11.

tell application "itunes" set myshows selection repeat eachshow in selection set desc description of eachshow set long description of eachshow desc end repeat end tell

does know how create work again? doesn't have set shows selection, can tv shows in library. wan't run same script on movies in library.

osx applescript itunes

android - Function with return value uses AlertDialog -



android - Function with return value uses AlertDialog -

i'm overriding function interface (which can't modify), let's say

public abstract int getresult();

in function, i'd inquire user of result should be, using alertdialog. implementation should like:

public int getresult() { int result; dialoginterface.onclicklistener dialogclicklistener = new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { switch (which){ case dialoginterface.button_positive: result = 1; break; case dialoginterface.button_negative: result = 2; break; } } }; alertdialog.builder builder = new alertdialog.builder(this); builder.setmessage("what result?").setpositivebutton("1", dialogclicklistener) .setnegativebutton("2", dialogclicklistener).show(); homecoming result; }

obviously, won't work due asynchronous nature of alertdialog. proper way deal kind of situation?

you must run code on ui thread like:

runonuithread(new runnable() { public void run() { getresult(); } });

or

public int getresult(){ runonuithread(new runnable() { public void run() { // code } }); }

android asynchronous

javascript - image will be clicked automatically one time -



javascript - image will be clicked automatically one time -

i have image in site:

<img src = "bird.jpg" class="main_mark">

i want while user enters site, image clicked 1 time automatically.

how can that? maybe should define in javascript code?

you should able trigger popup 1 click using:

$(document).ready(function(){ $('.main_mark').click(function(){ youtubepopup({ idattribute: 'id', 'modal': true }); }); });

javascript

c++ - Marmalade Sdk Resolution of Screen Size -



c++ - Marmalade Sdk Resolution of Screen Size -

i'm mobile game developer on marmalade newly. wanna screen height , width resolution of different screen size. what's difference between iw2dgetsurfacewidth() , iwgxgetscreenwidth(), totaly same or if not 1 better?

iwgx , subcomponents utilize 3 different types of surfaces.

device, holds width , height of device, without worrying screen orentation.

screen, same device switches width , height when device orientation changed.

surface, made programmer. it's create surfaces. screen can have several surfaces or none @ all, images. rectangular object used ui.

for more info can in documentation:

http://docs.madewithmarmalade.com/native/api_reference/iwgxapidocumentation/iwgxapioverview/screenmanipulation.html

and

http://docs.madewithmarmalade.com/native/api_reference/iw2dapidocumentation/iw2dapioverview/usingsurfaces.html

c++ ios mobile marmalade

Python - filter char based on type into a structure -



Python - filter char based on type into a structure -

i've been banging head against couple of days, tried variety of approaches, none of them seem work in way can use...

problem.

i given arbitrary byte stream. there semantic elements buried in bytes. there curly brackets, square brackets , brackets. these indicated 3 different things - {} no. of bytes range, e.g. {17} 17 bytes. [] byte value, e.g. [90:95] bytes x90, x91, x92, x93, x94, x95. () byte value 'or' option, e.g. (46|47) means either x46 or x47.

there other grammatical constructs have detect, "!", "*", "?" , ":".

an illustration bytestream: 524946(46|58){4}434452367672736e

i'm trying filter it, like:

1 string 524946 2 token (46|58) 3 token {4} 4 string 434452367672736e

once have split up, can process further.

the closest have come getting work (its ugly ugly ugly code...): http://pastebin.com/xlg2h0pw

i tried regex, not count string bytes within grammatical units normal string elements:

range_masks_list = [(m_mask1.span()) m_mask1 in re.finditer("\{([0-9]+|[0-9]+-[0-9]+|[0-9]+-\*)\}",sequence)] ## looks {int}, {int-int} , {int-*} byte_masks_list = [(m_mask2.span()) m_mask2 in re.finditer("\[[a-fa-f0-9]{2}:[a-fa-f0-9]{2}]",sequence)] ## looks [a:b] , b byte ranges options_sets_list = [(m_mask3.span()) m_mask3 in re.finditer("\(([a-fa-f0-9]{2})+\|([a-fa-f0-9]{2})+(\|([a-fa-f0-9]{2})+)*\)",sequence)] ## looks regex or clauses e.g. (a|b) string_chunk_list = [(m_mask4.span()) m_mask4 in re.finditer("([a-fa-f0-9]{2})+",sequence)] ## looks uninterrupted hex byte spans

which like:

def do_fragmenter(self,sequence): """ converts grep grammer normalised string set of fragments , offsets sig population""" sequence = sequence.replace(" ","") range_masks_list = [(m_mask1.span()) m_mask1 in re.finditer("\{([0-9]+|[0-9]+-[0-9]+|[0-9]+-\*)\}",sequence)] ## looks {int}, {int-int} , {int-*} byte_masks_list = [(m_mask2.span()) m_mask2 in re.finditer("\[[a-fa-f0-9]{2}:[a-fa-f0-9]{2}]",sequence)] ## looks [a:b] , b byte ranges options_sets_list = [(m_mask3.span()) m_mask3 in re.finditer("\(([a-fa-f0-9]{2})+\|([a-fa-f0-9]{2})+(\|([a-fa-f0-9]{2})+)*\)",sequence)] ## looks regex or clauses e.g. (a|b) string_chunk_list = [(m_mask4.span()) m_mask4 in re.finditer("([a-fa-f0-9]{2})+",sequence)] ## looks uninterupted hex byte spans string_chunks = [] string_chunks_len = [] pair in string_chunk_list: string_chunks.append(sequence[pair[0]:pair[1]]) string_chunks_len.append(len(sequence[pair[0]:pair[1]])) print zip(string_chunks,string_chunks_len)

just taking consideration grammatical elements have defined, maybe utilize (replace prints processing need):

#! /usr/bin/python3.2 import re = '524946(46|58){4}434452[22:33]367672736e' patterns = [ ('([0-9a-fa-f]+)', 'sequence '), ('(\\([0-9a-fa-f]+\\|[0-9a-fa-f]+\\))', 'option '), ('({[0-9a-fa-f]+})', 'curly '), ('(\\[[0-9a-fa-f]+:[0-9a-fa-f]+\\])', 'slice ') ] while a: found = false pattern, name in patterns: m = re.match (pattern, a) if m: m = m.groups () [0] print (name + m) = [len (m):] found = true break if not found: raise exception ('unrecognized sequence')

yields:

sequence 524946 alternative (46|58) curly {4} sequence 434452 piece [22:33] sequence 367672736e

python

table - A machine has a 32 bit address and an 8KB machine -



table - A machine has a 32 bit address and an 8KB machine -

a machine has 32-bit address space , page size of 8kb. page table exclusively in hardware, 1 32-bit word per entry. when process scheduled, page table copied hardware memory, @ rate of 1 word / 100 ns. if each process runs 100ms (including time load page table), fraction of cpu time devoted loading page tables?

yes homework problem. looked , far i've found that

size of pagetable(bytes) = number of entries *size of entry. hence x= 32*8192(bits) = 262144

i know wrong reply , it's 52; 4288ms using in latter equation of

time load page table / total time = cpu utilize

a solution can't quite understand posted here.

http://www.cs.inf.ethz.ch/ssw/exercises/solution_04.pdf

the tricky part here calculating size of page table. 1 time have that, multiply times time takes load each table entry. not relevant how big table entry is--only how long takes load.

so think 32 bit address space. how many 8k chunks there in it. that's part of document referenced subracting bits. takes 13 bits describe 8k. notice 2 ^ 13 = 8k (quick calculate noting 1024 takes 10 bits. sort of mnemonic , easy remember. 8 takes 3 bits , 10 + 3 = 13. or utilize calculator see powerfulness of 2 equals 8k.)

32 bits whole address space less 13 gives 19, there 2 ^ 19 pages.

now multiply 2 ^ 19 times 100 ns , bingo. have it.

table size 32-bit memory-address

java - What is different between this two arrayList definition? -



java - What is different between this two arrayList definition? -

this question has reply here:

type list vs type arraylist in java 12 answers

i utilize 2 statements arraylist definition:

arraylist<string> = new arraylist<>(); list<string> my2 = new arraylist<>();

which 1 should use?

with sec definition, later replace arraylist constructor type of list, linkedlist or high-performant list, or other kind of list may exist in future. in first definition, tied arraylist implementation forever. cannot alter it, because rest of code trusting in reference beingness explicitly arraylist.

by using interface, on contrary, code relies on contract, of interface, , not in particular implementation (like arraylist). gives powerfulness of changing implementations without affecting users. , alter must foster , plan ahead, because cannot prevent things changing.

java arraylist

ios - Can't make Restkit 0.20 + CoreData work -



ios - Can't make Restkit 0.20 + CoreData work -

i trying fetch content http json resource (categories list) , connect restkit , coredata.

my mapping used work when didnt utilize coredata. decided utilize next tutorial:

http://www.alexedge.co.uk/portfolio/introduction-restkit-0-20/

however, getting weird error , cant find out why:

the entity (null) not key value coding-compliant key "remoteid"

my category model / entity has remoteid mapped id on server, not issue. however, error seems restkit or coredata cant figure out entity i'm talking (they null entity??)

this request code:

- (nsfetchedresultscontroller *)fetchedresultscontroller{ if (!_fetchedresultscontroller) { nsfetchrequest *fetchrequest = [nsfetchrequest fetchrequestwithentityname:nsstringfromclass([category class])]; fetchrequest.sortdescriptors = @[[nssortdescriptor sortdescriptorwithkey:@"name" ascending:yes]]; self.fetchedresultscontroller = [[nsfetchedresultscontroller alloc] initwithfetchrequest:fetchrequest managedobjectcontext:[rkmanagedobjectstore defaultstore].mainqueuemanagedobjectcontext sectionnamekeypath:nil cachename:@"category"]; self.fetchedresultscontroller.delegate = self; nserror *error; [self.fetchedresultscontroller performfetch:&error]; nslog(@"%@",[self.fetchedresultscontroller fetchedobjects]); nsassert(!error, @"error performing fetch request: %@", error); } homecoming _fetchedresultscontroller; }

and mapping:

+(void) preparemapping { rkobjectmanager *manager = [rkobjectmanager sharedmanager]; nsdictionary *categoryattributes = @{ @"id" : @"remoteid", @"created_at" : @"updatedat", @"created_at" : @"createdat", @"name" : @"name", @"ads_count": @"adscount", }; rkentitymapping *categorymapping = [rkentitymapping mappingforentityforname:@"category" inmanagedobjectstore:manager.managedobjectstore]; [categorymapping addattributemappingsfromdictionary:categoryattributes]; categorymapping.identificationattributes = @[@"remoteid"]; [manager addresponsedescriptorsfromarray:@[ [rkresponsedescriptor responsedescriptorwithmapping:categorymapping pathpattern:@"neighborhoods/:neighborhoodid/categories.json" keypath:@"index_categories.index_category" statuscodes:rkstatuscodeindexsetforclass(rkstatuscodeclasssuccessful)] ]]; }

i don't know if nsstringfromclass([category class]) work. did seek next code?

nsfetchrequest *fetchrequest = [nsfetchrequest fetchrequestwithentityname:@"category"];

additionally check out illustration core info project within of restkit v.020-rc1 zip file see how things going.

ios json core-data restkit

mysql - How do i correct this query? -



mysql - How do i correct this query? -

i have mysql query looks this:

select column1_value, column2_value some_table column2_value in (a,lot,of,comma,separated,values) , column1_value not in (select column1_value, column3_value some_table column3_value = some_number) order desc limit 4

but maintain getting error, wrong?

can't in , not in?

thanks in advance

the problem line

and column1_value not in (select column1_value, column3_value some_table column3_value = some_number)

notice inner subquery?

select column1_value, column3_value some_table column3_value = some_number

you returning 2 columns in data-set! should be

select column1_value some_table column3_value = some_number

or whatever (single!) column want test against.

mysql

java - HTML form for login always returns null values in request parameters -



java - HTML form for login always returns null values in request parameters -

i don't know why stuck in simple, cant out of it.

first html file using

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>welcome guest- please login</title> <script type="text/javascript"> function validate() { username = document.getelementbyid("username").value; password = document.getelementbyid("password").value; if( username==null || username=="" ) { alert("please come in username"); homecoming false; } if( password==null || password=="" ) { alert("please come in password"); homecoming false; } homecoming true; } </script> </head> <body> <form action="login" method="post"> <br /> name: <input type="text" name="username" id="username" /> <br /> password: <input type="password" name="password" id="password" /> <br /> <input type="submit" onclick="return validate()" /> </form> </body> </html>

and dopost() method of servlet

protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { userlogindaoimplementation usr = new userlogindaoimplementation(); string username = request.getparameter("username"); string password = request.getparameter("password"); system.out.println(username + password); user u = usr.getpassword(username); if( u.getpassword().equals(password)) { // if password matches response.sendredirect("images"); } else { response.sendredirect("invalid"); } }

i have searched net kinds of queries nil works. know there problem of enctype , , have tried along numerous other experiments. every time run this, print statements print nullnull , null pointer exception thrown. really stuck this. please tell me wrong.

i using eclipse juno tomcat , other java ee plugins.

edit:

just suspected, problem somewhere else entirely. run programme today without touching previous code , worked charm. dont know hell wrong yesterday. new eclipse , noticing such behavior eclipse 1 time again , 1 time again since started using tomcat. had restart eclipse create render changes made in html files love have work around. restarted eclipse several times problem not working @ all. so can please guide me tips remembered while working web applications in eclipse...

java servlets

asp.net - iam need this query from db -



asp.net - iam need this query from db -

please help me excute query

id fdevicename fdevicetype 1 case mini 2 rack b 3 amir d 4 rack 5 case max 6 case mini

i want query back

id fdevicename fdevicetype count 1 case mini 2 2 rack b 1 3 amir d 1 4 rack 1 5 case max 1

select id, fdevicename, fdevicetype, count(*) table grouping fdevicename, fdevicetype

asp.net sql-server