Posts

Showing posts from April, 2013

How to retrieve properties from ASP.NET Membership, Profile? -

in web.config defined property: <profile> <properties> <add name ="creator" type ="system.string"/> </properties> </profile> i can set values property, like httpcontext.profile.setpropertyvalue("creator", membership.getuser(user.identity.name).provideruserkey.tostring()); but how can value, based on membershipuser? if iterate through membershipusercollection in view, how can display property creator ? @foreach (membershipuser user in (viewdata["users"] membershipusercollection)) { //how @user creator? } thank in advance! profile properties not set on membershipuser object. instead, authenticated user, can use "profile" property directly in code: profile.creator

How do I define a style for even and odd rows of a table (python reportlab) -

i have print report may hundreds rows in length. particularity each item's content should printed on 2 lines. lines have specific style. sample : line 1 : first header line line 2 : second header line line 3 : name , adress line 4 : birth date , gender, hobbies line 5 : name , adress line 6 : birth date , gender, hobbies ... i use table handle per page content. in style definition, have this: ('fontsize',(0,2),(-1,-1),18) but want style applies rows , style 1 ('fontsize',(0,2),(-1,1),12) applies odds rows. the best 2 styles applies on whole table except first , second row contains header of table. you can having code generates table style based on row number. reportlab have built-in feature automatically alternating background colors rows , colors (look rowbackgrounds , colbackgrounds in user manual), arbitrary styles you'll have custom following looping through data rows. table_style = [...] i, row in enumerate(table_rows

php - How do I Get the cummulative total of equation in MySql statement -

i have following mysql statement, cannot cummulative total 'ranking' in while loop select *, q1 + ((q1 + q2 + q3 + q4 + q5 + q6) / 6) ranking / sum(ranking) table field = :field group id this part of query works perfectly: q1 + ((q1 + q2 + q3 + q4 + q5 + q6) / 6) ranking i need divide 'as ranking' value sum of each 'ranking' row in query output , return in $rankingpercentage variable in while loop. q1 q2 q3 q4 q5 q6 fields in 1 table , contain number values (varchar) between 0 , 100. i expect return output $rankingpercentage 'ranking' (my equation above "as ranking") divided sum of 'ranking' rows returned in sql query. my while loop below: while($row = $sqlprep->fetch(pdo::fetch_obj)){ $ranking = $row->ranking; echo '<tr valign="bottom"><td>' . $row->id . '</td>'; echo '<td>' . $row->uid

mysql - PHP Include multiple files are trying to merge SQL Queries -

i have webpage automatically refreshes every 20 seconds check new emails , few other bits. the 1 file automate.php has <?php include ... ?> 6 files. in 6 of files included run sql queries if 2 run @ 1 through automate.php file try go together. for example, if include1.php , include2.php both run query @ same time include1.php: ($sql="query here";) include2.php: ($sql="query here";) they both $sql dont know differece. whats best way stop happening? it's not problem run simultaneously (which i'm not sure in case). if have website has form inputs information database each time it's filled out, if 2 people fill out form @ same time break website? edit: if i've misunderstood , meant query 2 using query stored in first $sql , doesn't because you've redefined second query, , re defined again query 3 / 4 / 5 etc. ie: //query 1 $sql = 'select * `test`'; //rest of query //query 2 $sql = 'sele

objective c - SecPKCS12Import function doesn't work properly if run agent/daemon under root -

i have osx agent should read data p12 file placed in project. there function secpkcs12import security.framework that. problem if run agent under root right after installing appropriated folder following function doesn't return certificate's data (&items parameter) returns status error "0". sudo launchctl load com.myagent.agent.plist but after osx reboot agent startups under root , works fine. if run agent under user permissions works fine without osx reboot. here plist file: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>username</key> <string>root</string> <key>standarderrorpath</key> <string>/usr/local/myagent/agent.log</string> <key>standardoutpath</key> <string&

vb6 - String(33, 0) in VB 6.0 and equivalent in C# -

what meaning of username = string(33, 0) in vb 6.0 , equivalent in c#. please i'm getting error while converting vb 6.0 code c#. thanks in advance. string in vb6 function returns string containing repeating character string of length specified. string(number,character) example: strtest = string(5, "a") ' strtest = "aaaaa" strtest = string(5, 97) ' strtest = "aaaaa" (97 ascii code "a") in case, string(33,0) return string containing 33 null characters. the equivalent in c# be username = new string('\0', 33);

xcode - libxml/xmlwriter.h not found in XCode4.6.1 -

i have integrated linkedin library ios app [https://github.com/resultsdirect/linkedin-iphone/]which builds fine in xcode 4.5.1 ios 6.0,..but when use xcode 4.6.1 build fails saying libxml/xmlwriter.h not found i've added libxml2.dylib library , /usr/include/libxml2 header paths .still error persists. can please me in this. in advance. did add ${sdkroot}/usr/include/libxml2 header search path in build settings ?

asp.net - How to bind imageurl to its imageId stored in database? -

i have uploaded image , store folder in asp.net , stored description in database photo table contains following column productphoto column name data type constraint photoid int primary key,auto increment photoname varchar(100) extname varchar(100) phototype varchar(100) photosize int productid int foreign key product info and stored image in folder named "upload" and in gridview in have bound columns database have taken image in item template , and bind imageurl using code <asp:gridview id="gridview" autogeneratecolumns="false" runat="server" style="margin-left: 0px" allowpaging="true" allowsorting="true" cellpadding="3" height="238px" backcolor="#deba84" bordercolor="#deba84" borderstyle="solid" borderwidth="1px" cellspacing="2"> <columns> <asp:boundfield head

html - How to set the 'selected option' of a select dropdown list with jquery -

i have following jquery function: $.post('getsalesrepfromcustomer', { data: selectedobj.value }, function (result) { alert(result[0]); $('select[name^="salesrep"]').val(result[0]); }); result[0] value want set selected item in select box. result[0] equals bruce jones . the select box populated database query 1 of rendered html is: <select id="salesrep" data-theme="a" data-mini="true" name="salesrep"> <option value=""> </option> <option value="john smith">john smith</option> <option value="bruce jones">bruce jones</option> <option value="adam calitz">adam calitz</option> <option>108</option> </select> $('select[name^="salesrep"]').val(result[0]); doesn't populate select box selected option. have tried $("#salesrep").val(result[0]); without luck. an

Android ActionBarCompat library -

i'm having trouble using actionbarcompat support library released yesterday. have updated support repository , included path appcompat-v7 repository in build.gradle chris banes pointing out in devbytes - https://www.youtube.com/watch?v=6tggyqfjnyc . dependencies { compile ('com.android.support:support-v4:18.0.+') compile ('com.android.support:appcompat-v7:18.0.+')} build goes , can use classes such actionbaractivity library cannot use styles , resources cannot use following themes - @style/theme.appcompat etc. thinking i'll find source files in .../sdk/extras/android/.../"supportrepo" reference actionbarsherlock gradle didn't seems correct answer. what doing wrong? thank you. i'm using android studio , have same res-resolving issue in values/styles.xml . it says cannot resolve @style/theme.appcompat.light , @ compile-time (gradle) , runtime works fine (android 2.3.3 & 4.3) . i'd rid of warning res cannot resolve

Error displaying map in Android application using maps application -

i building xamarin android app display map. not want use google maps trying maps application in-built. please see code below create intent , invoke using startactivity: var geouri = android.net.uri.parse("geo:42.374260,-71.120824"); var mapintent = new intent(intent.actionview, android.net.uri.parse("geo:42.374260,-71.120824")); startactivity(mapintent); i error on startactivity statement activitynotfoundexception. if change uri regular webaddress ( http://www.google.com ) app displays website. believe problem parsing geo address. i have included following references: using system; using android.app; using android.content; using android.runtime; using android.views; using android.widget; using android.os; using android.locations; using android.net; please let me know missing . thanks !

java - Formulating a regex with a single dot -

i trying formulate regex following scenario : the string match : mname87.com so, string may consist of number of alpha numeric characters , can contain single dot anywhere in string . i formulated regex : [a-za-z0-9.] , matches multiple dots(.) what doing wrong here ? the regex provided matches single character in whole string you're trying validate. there few things take care of in scenario you want match on whole string, regex must start ^ (beginning of string) , end $ (end of string). then want accept number of alpha-numeric characters, done [a-za-z0-9]+ , here + means 1 or more characters. then match point: \. (you must escape here) finally accept more characters again. all regex be: ^[a-za-z0-9]+\.[a-za-z0-9]+$

python - Scrollbar - make the background move but not the forderground -

on basic program (launcher) have scrollbar problem : make background-picture move not forderground widgets (buttons). the gui built follow : level 0 (parent = self) : canvas (self.c) background picture + scrollbars level 1 (parent = self.c) : buttons + invisible frame here code : # -*-coding:utf-8 -*- __future__ import unicode_literals import tkinter import imagetk import image class interface(tkinter.tk) : def __init__(self, parent) : tkinter.tk.__init__(self, parent) self.parent = parent self.initialize() # creation des widgets def initialize(self) : # fenetre principale self.minsize(437, 98) # scrollbars working on principal canvas self.c self.ascenseur_y = tkinter.scrollbar(self, orient=tkinter.vertical) self.ascenseur_x = tkinter.scrollbar(self, orient=tkinter.horizontal) self.ascenseur_y.grid(row=0, column=1, sticky="ns") self.ascenseur_x.grid(row=1, column=0, sticky=

HTML/CSS: Make a wrapper extend to fit the height of its children -

i making website. content stored in wrapper div. content div has border style assigned it. i want height of wrapper div tall enough fit it's content, border goes end of page. i thought happen default, height:auto default value of elements. here page . thanks can offered. just make wrapper div style overflow: auto

node.js - Complicated nested request in MongoDB -

i have collection documents of format: { "_id" : objectid("51b1e27e31b1f4fe0700001b"), "proposals" : [ { "id" : 17, "type" : "question", "fr" : {nothing useful}, "en" : {nothing useful}, "vote_count" : 0, "validate" : 0, "username" : "username", "voters" : [ ], "creationdate" : isodate("2013-07-25t08:32:40.328z") }, {other proposals of same type} ] }, {same format} i'm trying update proposal matched id receive, in right parent. have found a request on mongo cookbook used successfully, on less complicated data format, , can't make works n

c# - XML Fields with Entity Framework Code First -

i'm using entity framework code first model (pet project, , love editing simple classes , having schema updated automatically). have class follows: [table("polygons")] public class polygon { public int polygonid { get; set; } public string texture { get; set; } public virtual icollection<point> points { get; set; } } [table("points")] public class point { public int polygonid { get; set; } public double x { get; set; } public double y { get; set; } } it's useful me store polygons in database, , able query texture. on other hand, if i'm saving polygon 5,000 points database takes forever run many inserts, , honestly, i'm never going querying points except retrieve individual polygon. what i'd love rid of "polygonid" in "point" class, rid of "points" table, , have polygon table like polygonid int pk texture varchar(255) points xml and have points serialize string saved dir

r - Aggregate a data.frame by time series and with different functions -

i have lots of measurement values, recorded each minute. of values have mean, min , max values given minute. i'd summarize/aggregate whole data.frame have 1 entry every 30 minutes, str(wgdata) 'data.frame': 115200 obs. of 7 variables: $ timestamp : posixct, format: "2012-11-24 00:00:00" "2012-11-24 00:01:00" "2012-11-24 00:02:00" 7"2012-11-24 00:03:00" ... $ record : int 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 ... $ tpanel : num -0.075 -0.075 -0.075 -0.095 -0.095 -0.095 -0.095 -0.118 -0.118 -0.118 ... $ vbattery : num 13.8 13.8 13.8 13.8 13.8 ... $ vbatteryheating_avg: num 12.2 12.2 12.2 12.2 12.2 ... $ vbatteryheating_min: num 12.2 12.2 12.2 12.2 12.2 ... $ vbatteryheating_max: num 12.2 12.2 12.2 12.2 12.2 ... so i'd calculate every 30 minutes: timestamp , mean of tpanel (temperatur of panel), mean of vbattery , mean of vbatteryheating_avg , m

c# - Linq JObject query -

i have problems jobject , jarray linq query. error: unable cast object of type 'newtonsoft.json.linq.jobject' type 'newtonsoft.json.linq.jarray'. my code: string fetchresult = jsonconvert.serializeobject(sidebar, formatting.indented); jobject rss = jobject.parse(fetchresult); var jsonmodel = item in (jarray)rss["registrationcase"] select new datalist { registrationtypename = item["registrationtypename"].value<string>(), }; if remove (jarray) get: cannot access child value on newtonsoft.json.linq.jproperty. json, jobject: e.g: want registrationtypename, firstname , value of journalnumber. { "status": null, "registrationcase": { "registrationtypename": " ", "expiredate": null, "personid": 7, "person": { "firstname": " ", "gendervalue": 2, "ge

asp.net - .net using and reaching public value -

i wrote code in .net. when want change ‘s’ clicking button2, doesn’t change. mean after clicking button2 , click button1 see changes nothing changes. how can change , access value of ‘s’ properly. doing wrong? public string s; public void button1_click(object sender, eventargs e) { label1.text = s; } public void button2_click(object sender, eventargs e) { s = textbox1.text; } you need understand how web applications work. in each post instance of class handles page loaded, when click on button 1, page post , loads again, way variable s isn't loaded content. to make code work, need save s values on page viewstate. try replacing "public string s;" this: public string s { { return (string)viewstate["myvalue"]; } set [ viewstate["myvalue"] = value }; } more information page life cycle at: http://msdn.microsoft.com/en-us/library/ms178472(v=vs.100).aspx

google maps - Navigation in android app for updating of destination location -

scenario : in android app, have google map showing me friend's location. friend , can move position , still want him (finding friend's location/updated_location not issue). reach him fast, implementing navigation functionality it. question : how can implement navigation google map? heard opentripplanner , i'm not sure if can use in google maps. as friend's , location can change, want update navigation path current location current location. (an idea have recalculate path when friend's location changes). i want implement voice navigation app. how can this? any suggestion satisfy above requirement appreciated. please suggest sample code , working functions can used. you can take @ blog post wrote on implementing navigation polyline google maps api v2 : google maps api v2 polyline navigation there find needed method navigation instruction google directions api , paint on map.

javascript - how to call multiple onkeyup events on one html-tag -

can call multiple onkeyup events on same html input-tag? <input style="float: left; width: 50px;" id="personlength" name="personlength" onkeyup="checknr(this.id)" onkeyup="fill()" type="text"> something that? <input style="float: left; width: 50px;" id="personlength" name="personlength" onkeyup="checknr(this.id), fill()" type="text"> or this? ive treid them both might have wrong syntax? or there better way it? you not call onkeyup events, events, happen . you can use eventlistener api add multiple event listeners. var input = document.getelementbyid("my_input"); input.addeventlistener("keyup", function () { dosomething(); }); input.addeventlistener("keyup", function () { dosomethingelse(); }); // .. etc the alternative notation be: <input .. onkeyup="checknr(this.id); fill()" type=

winforms - Clone object without changing the values of the original object C# -

i need make copy of mygame class , use in simulation game trials before select move play. for example : public class mygame { private int start; private board board; //constructor public void play() { //play game } public object clone() { } } public class board { private int count; //constructor //some methods , properties public object clone() { } } writing code method clone() have tried memberwiseclone() (board) this.memberwiseclone() board b = (board) this.board i have read alot of articles , forums topic. answer people use deep cloning objects in c#, tried samples respect project still simulation modifying original object (mygame class) , not copy. here have example deep copy, copies reference type objects used copy constructor : public sealed class mygame { private int start; private board board; public mygam

grouping - Jasper Report group subreports using columns -

i have master report (using ireport 5.0.4) subreport uses grouping field called "group number" (sorry, actual column name). my report works fine when there more 1 group, generates each group result scrolling down page vertically. i able have each group go across vertically, when tried using columns, forces each group's data columns, , not entire group 1, followed group 2 in next column, etc. there can 8 groups, hoping not have create 8 individual sub-subreports "print when" expression show/hide them. can tell me if should possible? thanks, mitch i think making subreports easiest , obvious way. if want make in other way, can suggest use scriptlet, , form dataset manually (transpose it). another suggestion when generating report directly database (i.e. passing connection jasper) can modify query , transpose data (pivot table). anyway provide more info case. try you.

Reading from a CSV/text file with quotes in C++ -

i have working function reads lines text file (csv), need modify able read double quotes (i need have these double quotes because of string values contain commas, using double-quotes denote fact read function should ignore commas between double-quotes). there relatively simple way modify function below accommodate fact of fields enclosed in double quotes? a few other notes: i have of fields enclosed in double-quotes if helps (rather ones strings, case) i change delimiter comma other character (like pipe), hoping stick csv if easy so here current function: void readloandata(vector<modelloandata>& mloan, int dealnum) { // variable declarations fstream inputfile; string curfilename; ostringstream s1; string curlinecontents; int linecounter; char * cstr; vector<string> currow; const char * delim = ","; s1 << "modelloandata" << dealnum << ".csv"; curfilename = s1.str(); inputfile.open(curfilename, ios::in); i

java - Replacing a full ORM (JPA/Hibernate) by a lighter solution : Recommended patterns for load/save? -

i'm developing new java web application , i'm exploring new ways (new me!) persist data. have experience jpa & hibernate but, except simple cases, think kind of full orm can become quite complex. plus, don't working them much. i'm looking new solution, closer sql. the solutions i'm investigating : mybatis jooq plain sql/jdbc, potentially dbutils or other basic utility libraries. but there 2 use cases i'm worrying solutions, compared hibernate. i'd know recommended patterns use cases. use case 1 - fetching entity , accessing of associated children , grandchildren entities. let's have person entity. this person has associated address entity. this address has associated city entity. this city entity has name property. the full path access name of city, starting person entity, : person.address.city.name now, let's load person entity personservice , method : public person findpersonbyid(long id) { //

python - Tuple comprehension time profiling -

lately i've been doing time profiling of scripts. wondering tuple comprehension i've found several threads on pointing out 2 ways of doing : list comprehension + tuple() >>> tuple([i in xrange(1000000)]) tuple comprehension >>> tuple(i in xrange(1000000)) i'm puzzled fact cprolile , timeit tell me first method faster second on , command line time , kernprof line profiler contrary. here get: >>> import cprofile >>> cprofile.run('tuple([i in xrange(1000000)])') 1000003 function calls in 0.139 seconds >>> cprofile.run('tuple(i in xrange(1000000))') 1000003 function calls in 0.478 seconds >>> import timeit >>> timeit.timeit('tuple([i in xrange(1000000)])') 0.08100390434265137 >>> timeit.timeit('tuple(i in xrange(1000000))') 0.08400511741638184 with test_tuple_list.py: tuple([i in xrange(1000000)]) and test_tuple_generator.py: tuple(i in xrange

concurrency - Java thread id not changing -

i'm trying unit test class containing threadlocal , wish make tests not affect each other starting new thread in each test. however, still do, , don't understand why. @test public void testthread() { system.out.println(thread.currentthread().getid()); new thread(){ @override public void run(){ system.out.println(thread.currentthread().getid()); } }.run(); } output: 1 1 can explain why ids same though new thread started? you should call start method on thread, not run method. if call run, running in same thread.

c# - + string concat operator with a null operand -

a co-worker showed me strange behavior , i'd know if explain me why. a basic constructor 2 string params: public myclass(string str1, string str2) { this.s1 = str1; this.s2 = str2; this.s3 = method(str2 + "._classname", str1); } method is: public string method(string key, string defaultvalue) { list<string> list = _vars[key]; if (list == null) return defaultvalue; string res = ""; foreach (string s in list) { if (res != "") res += ","; res += s; } return res; } when ctor called within aspx page str2 null , works fine because if operand of string concatenation + null , empty string substituted. but when ctor called str2 null in background thread, nullreferenceexception fired. the problem solved testing str2 != null before using it, i'd know why same code fires exception, not! here stack trace: exception: system.nullreferenceexc

jquery - Send an Object from the View -

i've got table populated list of products, using jquery append new row table, want create new product new row , add list. this product model: public class product { public int productid { get; set; } public string productname { get; set; } public decimal price { get; set; } public int productstate { get; set; } } the index model view display list of product: public class billviewmodel { public selectlist clientlist { get; set; } public int selectedclient { get; set; } public selectlist productlist { get; set; } public int productselected { get; set; } public list<product> listproducts { get; set; } public list<client> listclients { get; set; } } this view, hidden field send list of product when click post: <table id="tabla"> @for (int = 0; < model.listproducts.count(); i++) { <tr> <td> @html.displayfor(model => m

osx - Migrating a C# windows service to Mac -

we have c# server registered service on windows , want run on mac (10.7.3). i have installed monoframework, , tried run executable via command line (mono xxx.exe) , got fatal error. i realized since supposed service, there code actual registration. there .bat file registers it. is there magical way can run , work? (guess not) since have source code, should next step(s)? thanks

list - Swipe to delete in QML -

is possible delete items listview in qml on webos, i.e. after swiping entry there's "cancel" , "delete". i'd use qt 4.7 (so qtquick 1.1) there no default component in qtquick can handle gesture signals. there qt labs project introduced gesturearea may want. not pacakged qtquick 1.1 , unsure current status feel free give try. http://blog.qt.digia.com/blog/2010/10/05/getting-in-touch-with-qt-quick-gestures-and-qml/ otherwise, there no qml solution although qt have gesture programming support http://qt-project.org/doc/qt-4.7/gestures-overview.html

haskell - Partially applying fst and snd using let in GHCi gives a strange type signature -

i'm implementing vanilla binary tree, , i'm implementing insertwith function, such can insert values transforming existing values "keys" - may allow to, say, store tuple of (key, value) , compare keys when inserting new "nodes". implementation following: insertwith :: (ord b) => (a -> b) -> bintree -> -> bintree insertwith _ emptytree y = node y emptytree emptytree insertwith f (node x l r) y = case compare (f y) (f x) of lt -> node x (insertwith f l y) r eq -> node x l r gt -> node x l (insertwith f r y) when partially apply fst using let in ghci, following: let insertwith_ = insertwith fst :t insertwith_ insertwith_ :: bintree ((), b) -> ((), b) -> bintree ((), b) however, leaving out let step gives following: :t insertwith fst insertwith fst :: (ord a) => bintree (a, b) -> (a, b) -> bintree (a, b) i think has (ord b) in type signature, i'm wondering why ghci tr

javascript - IE 8 throwing type mismatch error on replaceChild() -

i'm trying dynamically generate iframe javascript in order keep populating browser history. works in firefox, chrome, , ie9, ie8 throws 'type mismatch' error on replacechild() line. here function i've written: function frame(ref) { var iframeheadercell = document.getelementbyid('frame'); var oldframe = iframeheadercell.childnodes[1]; //create new iframe element var iframeheader = document.createelement('iframe'); iframeheader.src = ref ; iframeheader.frameborder = 0; //replace iframe new 1 iframeheadercell.replacechild(iframeheader, oldframe); return false; } and relevant html: <a href="#" onclick="return frame('products/embo_balloon.html');" class="product">embo balloon</a> <!-- dynamically inserted iframe goes inside div --> <div id="frame"> <iframe></iframe> </div>

java - check what button on form caused action -

i've got such form on page <form action="toolbaraction.do" method="post"> <div id="toolbar" class="ui-widget-header ui-corner-all ui-widget-content"> <input style="font-family: times new roman;" type="button" id="item0" value="<fmt:message key='main'/>" /> <input style="font-family: times new roman;" type="button" id="item1" value="<fmt:message key='prices'/>" /> <c:choose> <c:when test="${enterattr == false || enterattr == null }"> <input style="font-family: times new roman;" type="submit" id="item2" value="<fmt:message key='book'/>" /> </c:when> <c:when test="${enterattr == tru

listview - Update List-View when model change -

i'm not able update javafx.scene.control.listview<todo> control. can see listview displays headline property. when change headline of todo list-view still displays old value. public class todo { private stringproperty headline = new simplestringproperty(); private stringproperty description = new simplestringproperty(); public todo(string aheadline) { this.setheadline(aheadline); } public todo(string aheadline, string adescription) { this(aheadline); this.description.set(adescription); } public string getdescription() { return this.description.get(); } public stringproperty descriptionproperty() { return this.description; } public void setdescription(string adescription) { this.description.set(adescription); } public string getheadline() { return this.headline.get(); } public void setheadline(string aheadline) { this.headline.set(aheadline); } public static observablelist<todo> getmockups() { try { retur

android - Accessing TextBox List ID -

solved i have text box inside xml file called list_entry.xml. code file such: <?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_entry_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingtop="1dip" android:paddingbottom="1dip" android:paddingleft="5dip" style="android:attr/listviewwhitestyle" /> so it's not complicated. question is: how access "list_entry_title" textbox? keep getting crashes (nullpointerexception) when try use list_entry textbox. turns out made dumb mistake; used r.layout instead of r.id when trying access textboxes. commented!

c# - Changing the values of a Request on Aspnet -

i using postback function on javascript: <script type="text/javascript"> function callfunction(parameter) { __dopostback('func', parameter) } </script> and useit on c# public void page_load(object sender, eventargs e) { string parameter = request["__eventargument"]; // parameter var senderobject = request["__eventtarget"]; // func if(senderobject == "func") { //... } } my problem more 1 time, , "request" method return me values of first time used it. question how can change this? ok never mind, error cloned function without noticing, sorry kind of trouble

c# - How to export data in Groupbox into PDF? -

i have built simple windows form application using c#. stuck here , not find anywhere. what simple application queries out information in groupbox has textboxes labels , buttons. export or convert data in groupbox pdf. is there way implement that?? thank in advance~ you may want have @ http://www.pdfsharp.com/pdfsharp/ . it's pretty framework need. good luck

javascript - Merge two multidimensional arrays, but cant duplicate using datetime -

i wish merge 2 arrays one, cant duplicate using datetime, cant merge 2 results both arrays same datetime. in each array, datetime never repeated. both arrays have same structure, same exact positions. each array have +60 sub arrays. example: array1 = [[a,b,0000-00-00 00:00],[c,d,0000-00-00 00:59],[e,f,0000-00-00 00:10]]; array2 = [[z,x,0000-00-00 00:00],[h,s,0000-00-00 00:49],[e,f,0000-00-00 00:20]]; array12 = [[a,b,0000-00-00 00:00],[c,d,0000-00-00 00:59],[e,f,0000-00-00 00:10],[h,s,0000-00-00 00:49],[e,f,0000-00-00 00:20]]; how can make work? tried lot of functions, cant working. thanks. if i'm correct trying merge arrays based in timestamps. try out fiddle var array1 = [ ['a', 'b', '0000-00-00 00:00'], ['c', 'd', '0000-00-00 00:59'], ['e', 'f', '0000-00-00 00:10'] ]; var array2 = [ ['z', 'x', '0000-00-00 00:00'], ['h', 's&

ubuntu - how to zip the output of the mysqldump command? -

i have cron with #!/bin/sh #string representation current day day=$(date +%y%m%d) #archive db content /usr/bin/mysqldump --opt --host=db_host --user=db_user --password=db_pass db_name | /bin/gzip -c -9 > ${day}_db_name.gz which runs fine. however, create zip file instead using zip compression. i tried with /usr/bin/mysqldump --opt --host=db_host --user=db_user --password=db_pass db_name | zip -q -9 > ${day}_db_name.zip and result archive file named " - " inside. question how can change name previous command generated, 20130725_db_name ? it says here zip , input , pipeing , "streaming input , output" but, unfortunately, that's me understand

How to display email as hyperlink in php results -

i have database , i'm trying display email address hyperlink when query doesn't match on our database. i'm using following... php code... else{ // if there no matching rows following echo "<br /><br /><br /><strong><h2>"."you have searched term not in database. please contact <a href=\"mailto:email@domain.com" . htmlentities($_post['email@domain.com']) . "\">".htmlentities($_post['email@domain.com']) . "</a>, if think term should added."."</h2></strong>"; but, results this... "you have searched term not in database. please contact , if think term should added." everything's there except hyperlinked email address. thoughts? try this.. else{ // if there no matching rows following $mail = htmlentities('email@domain.com'); echo "<br /><br /><br /><strong><h

ruby on rails - update_column updates my instance.xxxable but not the instance itself? -

i'm not sure because i'm using rails 4 i'm puzzled. i have following models set: class post < activerecord::base has_many :stars, :as => :starable, :dependent => :destroy belongs_to :user end class star < activerecord::base before_create :add_to_total_stars belongs_to :starable, :polymorphic => true protected def add_to_total_stars if [post].include?(starable.class) self.starable.update_column(:total_stars, starable.total_stars + self.number) end end end class user < activerecord::base has_many :posts, dependent: :destroy has_many :votes, dependent: :destroy end so created star , post in rails console: star = post.stars.build number: 2 post = post.create title: "test", content: "test", user_id: 1 then used following modify average_stars column in post : star.starable.update(:average_stars, 4) everything ok far: star.starable => #<post id: 9, title: "test", conten

flash - jquery tools display a loader until all flashembed content is loaded completely -

i tried use jquerytools load swf content flashembed function. flashembed("flash-background", { src: "swf/background.swf", wmode: 'transparent', quality: 'high', width: '100%', height: '100%', allowfullscreen: 'true', scale: 'noborder' }); flashembed("flash-mp3player", { src: "swf/mp3player.swf", wmode: 'transparent', quality: 'high', width: '100px', height: '30px', allowfullscreen: 'false' }); html <!-- flash background --> <div id="flash-background"></div> <!-- flash player --> <div id="flash-mp3player"></div> i'd display loader until flash content loaded completely. how do? shall use jquery? thanks use $.deferred() achieve that

alfresco - Configuring the uploadConfig for Share -

is there documentation explains how configure upload config in yui. trying upload temporarily folder in user's home space don't need siteid that's specified in examples have been reading far. i'd configure object details need pass. found looking in share client side api accident. upload path can specified. var multiuploadconfig = { destination : this.options.tempfolder, containerid: "consultation", filter: [], mode: this.fileupload.mode_multi_upload, thumbnails: "doclib", onfileuploadcomplete: { fn: this.onfileuploadcomplete, scope: } };

javascript - jquery datepicker - add class to first 17 days -

is there way give class first 17 days on jquery datepicker calendar? i have tried seems add class every day... beforeshowday: function(date) { (i = 0; < 17; i++) { return [true, 'myclass']; } return [false, '']; } edit: i've managed following code: beforeshowday: function (date) { if (date <= new date().setdate(new date().getdate()+17) && date >= new date() ) { return [true, 'myclass']; } return [true, '']; } the problem doesn't give class todays date. ideas why? maybe like: beforeshowday: function(date) { var today = new date(), maxdate; today.sethours(0,0,0,0); maxdate = new date().setdate(today.getdate() + 17); if (date <= maxdate && date >= today ) { return [true, 'myclass']; } return [true, '']; } jsfiddle

javascript - Using meteorjs how can I identify discrete connected clients? -

i want able treat each connected client differently based on conditions can't seem figure out how target individual client. need kind of unique reference per client can't find either on client or on server part of pub/sub interaction or otherwise. i noticed userid depends on user creating account , signing in, otherwise remains set null. how i, example, show message on recent client connect, or set queuing system give connected clients access limited resource? thanks! i think this.setuserid() can want: call function change logged in user on connection made method call. sets value of userid future method calls received on connection. pass null log out connection. you can check if id null , if set unique identifier. place in first method or publish function clients call. info on function , quote http://docs.meteor.com .

c - Inverting a PGM's Color Values Distorts the Image -

my goal read in pgm image , produce image inverted color values. when put in this image , this image . i'm programming in c, using eclipse , mingw gcc on windows 7 (64-bit). why image getting drastically distorted? int complement(pgmimage *img) { int i, j; // set new pgm copy onto pgmimage* comimg = (pgmimage*)malloc(sizeof(pgmimage)); (*comimg).width = (*img).width; (*comimg).height = (*img).height; // invert each pixel for(i = 0; <= (*img).width; i++) { for(j = 0; j <= (*img).height; j++) { // set inverted value each new pixel (*comimg).data[i][j].red = abs((*img).maxval - (*img).data[i][j].red); (*comimg).data[i][j].green = abs((*img).maxval - (*img).data[i][j].green); (*comimg).data[i][j].blue = abs((*img).maxval - (*img).data[i][j].blue); } } // save copy of complement image save("c:\\image_complement.pgm", comimg); printf("a copy of image has been saved \"c:\\image_complement.pgm\"\n\n");

Scribe-java and async request in Android 4 -

in android 4.2.2 emulator try use scribe code snippet: oauthservice service = new servicebuilder() .provider(twitterapi.class) .apikey("abc") .apisecret("aaa123") .debug() .build(); scanner in = new scanner(system.in); token requesttoken = service.getrequesttoken(); in logcat following error. think can because of scribe's example code not async-task. can recommend async example please ? note code snippet works in android 2.3.3. doesn't work in android 4.2.2. e/androidruntime: fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.myexample.android/com.myexample.android.myactivity}: org.scribe.exceptions.oauthconnectionexception: there problem while creating connection remote service. @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) @ android.app.activitythread.handlelaunchac

javascript - Is there a limit to how often an element's background-image can be modified? -

// repaints progress bar's filled-in amount based on % of time elapsed current video. progressbar.change(function () { var currenttime = $(this).val(); var totaltime = parseint($(this).prop('max'), 10); // don't divide 0. var fill = totaltime !== 0 ? currenttime / totaltime : 0; // edit: added check, testing now. if (fill < 0 || fill > 1) throw "wow should not have been " + fill; var backgroundimage = '-webkit-gradient(linear,left top, right top, from(#ccc), color-stop(' + fill + ',#ccc), color-stop(' + fill + ',rgba(0,0,0,0)), to(rgba(0,0,0,0)))'; $(this).css('background-image', backgroundimage); }); i'm filling progress bar on time using above javascript modify background-image gradient. extremely intermittently -- background image entirely stops rendering. i've placed logging throughout code , seems firing properly. i'm not dividing 0, nor fill 0, background imag