Posts

Showing posts from January, 2015

unicode - Writing UTF16 file with std::fstream -

is possible imbue std::fstream std::string containing utf-8 encoding can streamed utf-16 file? i tried following using utf8-to-utf16 facet, result file still utf-8: std::fstream utf16_stream("test.txt", std::ios_base::trunc | std::ios_base::out); utf16_stream.imbue(std::locale(std::locale(), new codecvt_utf8_utf16<wchar_t, std::codecvt_mode(std::generate_header | std::little_endian)>); std::string utf8_string = "\x54\\xe2\x83\xac\x73\x74"; utf16_stream << utf8_string; references codecvt_utf8_utf16 facet seem indicate can used read , write utf-8 files, not utf-16 - correct, , if so, there simple way want do? file streams (by virtue of requirements of std::basic_filebuf §22.4.1.4.2[locale.codecvt.virtuals]/3 ) not support n:m character encoding conversions case utf8 internal / utf16 external. you'd have build utf-16 string, e.g. using wstring_convert , reinterpret sequence of bytes, , output using...

asp.net - How to fill the text box with value of a column of a GridView row -

Image
in grid have following columns <columns> <asp:templatefield headertext="select pay"> <itemtemplate> <asp:checkbox id="chkselect" runat="server" oncheckedchanged="chkselect_oncheckedchanged" autopostback="true" /> </itemtemplate> </asp:templatefield> <asp:boundfield datafield="reference" headertext="invoice" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center"> </asp:boundfield> <asp:boundfield datafield="chargeddate" headertext="date of charge" headerstyle-horizontalalign="center" itemstyle-horizontalalign="center" dataformatstring="{0:mm-dd-yyyy}"> </asp:boundfield> <asp:boundfield datafield="amount" headertext="amount" headerstyle-...

UTF8 encoding without BOM - PowerShell -

i have bat file encode csv files. problem there 1 character @ begining of file once encoding have been done (bom byte guess). character bothers me cause after encoding, use file generate database. here line encoding (inside bat file): powershell -command "&{ param($path); (get-content $path) | out-file $path -encoding utf8 }" csvs\\pass.csv is there way encode file without bom (if problem)?? thanks! i found solution. change line this: powershell -command "&{ param($path); $utf8nobomencoding = new-object system.text.utf8encoding($false); $myfile = get-content $path; [system.io.file]::writealllines($path, $myfile, $utf8nobomencoding) }" csvs\\pass.csv

Ckeditor using and integration in node.js web page -

how integral ckeditor nodejs page? added ckeditor integration codes server.js file.but isnt work. this q offers solutions node.js (sails.js) wysiwyg editor - images @ least integrating http://sailsjs.org/ per q.

Android: change button color programmatically with defined drawable -

i have: public button[] getbuttons(int buttoncount, list<string> buttonheaders, context activity) { button[] result = new button[buttoncount]; (int = 0; < buttoncount; i++) { result[i] = new button(activity); result[i].setid(i); result[i].settext(buttonheaders.get(i)); result[i].setbackgroundresource(r.drawable.buttons_shape); result[i].setbackgroundcolor(randomcolor(activity)); result[i].settextcolor(activity.getresources().getcolor(r.color.white)); result[i].setwidth(360); result[i].setheight(100); } return result; } but in drawable is: <solid android:color="@color/white"/> <corners android:bottomrightradius="10dp" android:bottomleftradius="10dp" android:topleftradius="10dp" android:toprightradius="10dp"/> but define program color, because color random, , when change background retur...

java - what is difference between declaring variable out of main method and inside main method? -

when reading book java , saw 1 example written this. , wondering can declare variable in outside of main method ? difference between declaring variable outside , inside main method? " static" 's role in here ? please 1 explain me? new in java. public class printstuff { static int an_integer = 0; public static void main(string[] args) { int an_integer = 2; string[] some_strings = {"shoes", "suit", "tie" }; an_integer = an_integer - 1; some_strings[an_integer] = some_strings[an_integer] +"+++"; (int = 0; < some_strings.length; i++) system.out.println(some_strings[printstuff.an_integer]); } } best regards. 1) inside vs outside: if declare object inside method, visible in method. basically, if put brackets around it, it's visible/accessible within these brackets. if declare object outside method (inside class), dep...

sql - blank value istead in a mutiply subquery -

i have sql in sybase cumulative value of of quetity mulitiplied price gives blank values when want show real values. here code : select pmu.idval, pmu.idint, pmu.idnumecrppal, pmu.idsensope, pmu.dtecr, pmu.qteecr, pmu.prixacquis, (select sum(p1.qteecr) casimir.dbo.pmu p1 p1.idnumecrppal < pmu.idnumecrppal , p1.idint = pmu.idint) qcp, (select sum(p2.qteecr * p2.prixacquis) casimir.dbo.pmu p2 p2.idnumecrppal < pmu.idnumecrppal , p2.idint = pmu.idint) prup casimir.dbo.pmu pmu idint = 1733 order idnumecrppal here result: idval * idint * idnumecrppal * qteecr * prixacquis * qcp prup 650 1733 1074292 69 0.00 {null} {null} 650 1733 1165538 6 0.00 69 0.00 650 1733 1618644 7 0.00 75 0.00 650 1733 1934483 10 0.00 82 0.00 650 1733 1934484 ...

java - Spring MVC | IBM Websphere Application Server | Server Startup Error -

i getting following error while deploying spring mvc app on ibm 6.1. [17/07/13 12:31:55:466 bst] 0000001a webapp e exception caught while initializing context org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter#0': instantiation of bean failed; nested exception org.springframework.beans.beaninstantiationexception: not instantiate bean class [org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter]: constructor threw exception; nested exception java.lang.classcastexception: com.sun.org.apache.xalan.internal.xsltc.trax.transformerfactoryimpl incompatible javax.xml.transform.transformerfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiatebean(abstractautowirecapablebeanfactory.java:965) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.c...

file io - doubleclick on filename OPEN DEFAULT EDITOR in PowerShell ISE editor -

$fromdir = "c:\temp\sta\" $controlfilearray = get-childitem $fromdir\*.ssisdeploymentmanifest | % { ($_.basename)} echo $controlfilearray from above script, taking file name in 1 variable, how double click filename using power shell open in desired editor. if file c:\temp\t.txt try : $a = "c:\temp\t.txt" & $a

ruby on rails - Set ability.rb but still have admin able to delete user? -

i'm working in ruby , in ability.rb file, have: when "admin_junior" cannot :delete, user . . when "admin_senior" can :delete, user . . end but in users.rb file have actions :all, :except => [:edit, :new] i thought doing have when admins login, admin_junior not able delete user , admin_senior able delete user. allows both view delete option user, , apply well. how modify admin_junior not able delete users admin_senior will? sorry...first post had typo try this when "admin_junior" cannot :delete, user . . when "admin_senior" can :delete, user . . end

linux - How to count time from current reference time -

i need build simple ksh/bash scrip or whatever on linux t know count time reference time when type date command following: date wed jul 17 18:13:27 idt 2013 or [root@linux /var/tmp]# current_time=` date ` [root@linux /var/tmp]# echo $current_time wed jul 17 18:21:51 idt 2013 so here current date . what need count example 10 min current date , so after 10 min print message echo “sorry 10 min ended“ how count time reference time ? use date +%s unix time - number of seconds since 00:00:00 coordinated universal time (utc), thursday, 1 january 1970 - , use arithmetic expansion: current_time=$(date +%s) elapsed_time=$(( $(date +%s) - $current_time )) $elapsed_time number of seconds since $current_time . can check if $elapsed_time > 600 in loop. edit: completeness: if [[ $elapsed_time > 600 ]]; echo "sorry 10 min ended" fi this should work in both bash , ksh.

visual studio 2010 - Message "Please wait while IntelliSense and browsing information are updated." wasting my time -

i'm working large project , after every change of code "please wait" message "please wait while intellisense , browsing information updated." text , increasing number include files being processed (x/150000) few minutes. do have wrong in configuration or why tool analyzing include files again , again?

java - why does jpa query the same column multiple times when using a one to many relationship? -

i have jpa code persists user, has set of permissions. table in sql 2 columns, user_id , permission. when try read user, generated sql looks off. specifically, 2 columns selected multiple times. here relevant code... entity classes... @entity @table(name="users") public class user implements storable{ @onetomany(cascade=cascadetype.all) @joincolumn(name="user_id",referencedcolumnname="user_id") private set<permission> permissions; } @entity @table(name="permissions") public class permission implements storable{ @embeddedid permissionpk id; @mapsid("userid") @manytoone @joincolumn(name="user_id") user user; } @embeddable class permissionpk implements serializable{ @column(name="user_id") int userid; @column(name="permission") string type; } code queries... user u = em.find(user.class, 262); here query generated finding permiss...

Android - Unable to destroy activity after finish, caused by IllegalStateException: Can not perform this action after onSaveInstanceState -

i have activity in app 3 fragments. when button pushed on first one, method called in activity irrelevant stuff , calls finish() . this triggers onpause() on fragment, more irrelevant stuff , calls super.onpause() . the app loads old activity came on (logically following view stack), , crashes following exception when ondestroyview() called on fragment: fatal exception: main java.lang.runtimeexception: unable destroy activity {be.niteowl.niteowl.debug/be.niteowl.niteowl.views.activities.venueactivity}: java.lang.illegalstateexception: can not perform action after onsaveinstancestate @ android.app.activitythread.performdestroyactivity(activitythread.java:2793) @ android.app.activitythread.handledestroyactivity(activitythread.java:2811) @ android.app.activitythread.access$2100(activitythread.java:123) @ android.app.activitythread$h.handlemessage(activitythread.java:972) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:130) @ android.a...

Integer comparison in Python -

i came across odd. i'm kind of new python sorry if basics. a = 12 b = int(24/3) x = (a < b) from debugger: have: a (int) = 12 b (int) = 8 x (bool) = true so seems 8 > 12 in situation, i'm clueless here, explanation? ps: x = < b same (without brackets) edit i'm using squish (automatic tests), , seems that's issue asked colleagues test same snipet in squish , did same. this well-known behaviour , though not intuitive, behaviour of squish. int call doesn't use python int function rather invokes int constructor constructing integer can passed methods in application under test ( setwidth or so). i.e. squish overrides meaning of int . you can use import __builtin__ = 12 b = __builtin__.int(24/3) x = (a < b) to enforce getting python int .

javascript - Using result of logical tests for default values -

this more of "experience trenches" question. given piece of javascript /** * @param [foo] * {object} optional object (it can null, undefined, empty, etc..) * @param [foo.bars] * {array} array *might* in object */ function (foo) { // want array, or empty array in // of odd cases (foo null, undefined, or foo.bars not defined) var bars = []; if (foo && foo.bars) { bars = foo.bars } // .... } i'm trying shorten ; according mdn should ok write : function (foo) { var bars = (foo && foo.bars) || []; // ... } am missing case (set of value, or other browser) not work ? there shorter / cleaner way ? on more subjective node, consider unreadable ? thanks i don't @ all. conventional programmer, reads if resulting value true if (foo && foo.bars) evaluates true, otherwise empty array. i prefer see following: var bars = (foo && foo.bars) ? foo.bars : [];

iphone - select a row from view when a push notification is received -

i trying select row table view when push notification received. i have myprojectappdelegate.h #import <uikit/uikit.h> #import "iw.h" #import "bookmark.h" @interface myprojectappdelegate : nsobject <uiapplicationdelegate, uitabbarcontrollerdelegate> { uiwindow *window; uitabbarcontroller *tabbarcontroller; uinavigationcontroller *navigationcontroller; nsmutablearray *tabledata; nsmutablearray *imageslist; iboutlet bookmark *tablecell; } @property (nonatomic, retain) iboutlet uiwindow *window; @property (nonatomic, retain) iboutlet uitabbarcontroller *tabbarcontroller; @property (nonatomic, retain) iboutlet uinavigationcontroller *navigationcontroller; @property(nonatomic, retain) nsmutablearray *tabledata; @property(nonatomic, retain) nsmutablearray *imageslist; - (bool)getislaunched; - (void)showservice...

c++ - disallow access outside of file -

now know going static or anon namespace without reading let me no not i'm looking for. looking allow me kind of "quarantine" off file in code base can't access outside of file if changes it can't inadvertently screw things elsewhere. possible? what looking allow me kind of "quarantine" off file in code base can't access outside of file if changes it can't inadvertently screw things elsewhere. possible? for part, no, not part of c++ language. in order accomplish goal, consider one/some of following: moving code file library reduce likelihood of collateral damage providing "guarantees" testing dynamic tools valgrind , purify, asan ("address sanitizer"), electric fence making comments regarding intended design of code file ("isolated", "encapsulated", etc) build-time restrictions: dump preprocessed output source file, flagging cases new #include s (ones outside of whitelist, e.g.) sh...

c++ - Proper way to use SFINAE struct defintions -

for educative reasons, playing around sfinae behavior of c++ , building own version of std::enable_if in rather simplified form. noticed different behavior when using different implementation details though: implementation incomplete type: template <bool c, typename> struct enable_if; // incomplete type template <typename t> struct enable_if<true, t> { typedef t type; }; implementation empty type: template <bool c, typename> struct enable_if {}; // empty type template <typename t> struct enable_if<true, t> { typedef t type; }; on g++ (4.8.1 , 4.3.2) both versions compile , behave same way. msvc 2008 seems accept definition empty type. are both definitions valid c++, , should equivalent in behavior? from standard, § 14.8.2: type deduction may fail following reasons: [...] attempting use type in nested-name-specifier of qualified-id when type not contain specified member, or specified member not t...

How to enable multiprocessor compilation in call to msbuild but not in Visual Studio -

there number of teams in our company use subset of common libraries. projects able use different build scripts, , in 1 project we'd able build msbuild using /m option build projects in parallel (some other projects use devenv build). option can set in build script projects don't need change. the question how can apply /mp option cl.exe allow multiprocessor builds inside each project, without changing common libraries. inside visual studio can apply user property sheet, won't change project files, there way of doing same thing msbuild providing argument or property sheet can apply custom build settings without changing projects? edit: maybe simpler way of summarising question is: can add custom arguments cl.exe process when calling msbuild ? have tried set environment variable cl=/mp ?

c - reading a text file into an array -

i'm new programming, , after thinking hard week summer project, i'd appreciate help! i'm trying read in long text file, long string (nb: not actual programming string) of letters, , put each letter place in grid (the aim of program solve wordsearch) far i've come program below, doesn't seem producing grid, rather reprints text file, preceded following: {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf510 {\fonttbl\f0\fmodern\fcharset0 courier;} {\colortbl;\red255\green255\blue255;} \paperw11905\paperh16837\margl1440\margr1440\vieww10800\viewh8400\viewkind0 \deftab720 \pard\pardeftab720 \f0\fs24 \cf0 the program i've written this: #include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <stdbool.h> int main() { int i,j; char myarray[26][26],x; file *myfile; (j=0; j<26; j++) //initialise array elements 0 { (i=0; i<26; i++) { ...

javascript - jQuery displaying NaN -

i'm trying data element in html, jquery "nan" when ask jquery place grabbed data in paragraph tag. here full code: $(".next-panel").click(function(event) { var accordion = $(".nav-accordion") var index = accordion.accordion('option','active') var next = index + 1; var panel = $(this).parents('.accordion-panel').next(); var sectiontitle = $(this).parents('.accordion-panel').parents('li').next('li').children('a').attr('data-title'); var sectiondesc = $(this).parents('.accordion-panel').parents('li').next('li').children('a').attr('data-desc'); var sectionpercent = $(this).parents('.accordion-panel').parents('li').next('li').children('a').attr('data-percent'); $('body').animate({ scrolltop: $('#accordion-wrap').offset().top }, 800 ); ...

c++ - Is a destructor called when an object goes out of scope? -

for example: int main() { foo *leedle = new foo(); return 0; } class foo { private: somepointer* bar; public: foo(); ~foo(); }; foo::~foo() { delete bar; } would destructor implicitly called compiler or there memory leak? i'm new dynamic memory, if isn't usable test case, i'm sorry. yes, automatic variables destroyed @ end of enclosing code block. keep reading. your question title asks if destructor called when variable goes out of scope. presumably meant ask was: will foo's destructor called @ end of main()? given code provided, answer question no since foo object has dynamic storage duration, shall see shortly. note here automatic variable is: foo* leedle = new foo(); here, leedle automatic variable destroyed. leedle pointer. thing leedle points not have automatic storage duration, , not destroyed. so, if this: void doit() { foo* leedle = new leedle; } you leak memory allocated new leedle . ...

javascript - getElementById in separate js file doesn't find ASP.net control -

Image
when have in page markup works fine: <script type="text/javascript"> function bought1() { var s = '<%= button2.clientid %>'; var v = document.getelementbyid(s); v.click(); } </script> but when have same thing in separate file, though function is executed - value of v remains null . i tried simple div , did find div . why doesn't find asp.net button? edit i added clientidmode="static" button. no change. <%= button2.clientid %> server code. cannot run server code in separate javascript file. if want access server control id separate javascript, need make clientidmode either preditable or static. here example. the following code. not example, hope idea. note: make sure not have same ids when use clientidmode="static" . otherwise, ids collide. example, 1 in master page , 1 in content page. aspx <script src="/javascript1.js">...

forms - redactor rails can't use with simple_form -

i install gem 'redactor-rails', it's text editor. want use simple_form, have trouble. if use standart rails helper form_for: <%= form_for(@profile) |f| %> <%= f.text_area :aboutme, placeholder: "content goes here...", :class => "redactor"%> <% end %> it's right. can edit text bold, italic , etc. but when try use simple_form: <%= simple_form_for(@profile) |f| %> <%= render 'devise/shared/error_messages', object: f.object %> <%= f.input :aboutme, input_html: { class: "redactor", as: :text } %> <%= text_area_tag :editor, "ghbtd", :class => "redactor", :rows => 40, :cols => 120 %> <%= f.submit "Сохранить", class: "btn btn-primary" %> <% end %> i add text_area_tag usual form, it's create 2 fields, 1 field(with text_area_tag) it's works good, redactors field created simple_form become simple field, ...

c# - How to assign own method property to ObjectDataSource? -

i have objectdatasource enstantiated so: <asp:objectdatasource id="x" runat="server" insertmethod="xx" selectmethod="xxx" typename="xxxx" updatemethod="xxxxx"> select, insert, update methods expect; select data, insert data , update data. question is, there way can assign method e.g. second select selects different data or maybe deletemethod? yes, can. operation there event raised before operation performed , 1 event after performing operation. so, in case, select operation. event raised before operation x.selecting. set event handler in .aspx <asp:objectdatasource id="x" runat="server" insertmethod="xx" selectmethod="xxx" typename="xxxx" updatemethod="xxxxx" onselecting="x_selecting"> now, in selecting event handler change select method dynamically, 'x' id of object datasource. protected void x_selectin...

c - Does the C99 standard permit assignment of a variable to itself? -

does c99 standard allow variables assigned themselves? instance, following valid: int = 42; /* case 1 */ = a; /* case 2 */ int *b = &a; = *b; while suspect case 1 valid, i'm hesitant same case 2. in case of assignment, right side evaluated before assigning value variable on left -- or race condition introduced when dereferencing pointer variable being assigned? both cases valid, since value of a used determine value stored, not determine object in value store. in essence in assignment have distinguish 3 different operations determine object value stored evaluate rhs store determined value in determined object the first 2 of these 3 operations can done in order, in parallel. third consequence of 2 others, come after.

Alternative for using $find and jquery selector in order to get object in ASP.net application -

i call method of element can returned asp.net sys.application method "$find". in case telerik radwindow control (id="mywindow") , call .show() method. the problem correct client id of control in separate js file , since ids gets modified in asp.net framework. use $find($("[id$=mywindow]")[0].id).show(); this works if there 1 element on page id ends "mywindow". unfortunately control adds strange wrapper element page id ends "mywindow", too. so question: there better way asp.net element object in separate js file besides ugly combination of $find , jquery selection? you write small javascript enclosure @ end of page , add controls wish address in external files needed. <script> var controls = new function () { return { radwinmanagermain: { clientid: "<%= radwinmanagermain.clientid %>" }, radwinmanagersub: { clientid: "<%= radwinmanage...

Empty value powershell array -

i have strange issue, csv: serveur;carte;cordon;ip;mac;vmnic ;vmnic mac;connect;port dexter;eth1;405;172.16.5.117;00:24:e8:36:36:df;vmnic0;00:50:56:56:36:df;sw-front-1;a1 dexter;eth2;14;192.168.140.17;00:24:e8:36:36:e1;vmnic1;00:50:56:56:36:e1; sw_eq_ds_1;3 ;;;;;;;; gordon;eth1;404;172.16.5.124;b8:ac:6f:8d:ac:b4;vmnic0;00:50:56:5d:ac:b4;; gordon;eth2;35;192.168.140.114;b8:ac:6f:8d:ac:b6;vmnic1;00:50:56:5d:ac:b6;; gordon;eth3;254;192.168.33.10;b8:ac:6f:8d:ac:b8;vmnic2;00:50:56:5d:ac:b8;; so imported array following code: $serveur = @() import-csv c:\users\aasif\desktop\myfile.csv -delimiter ";" |` foreach-object { $serveur += $_.serveur } and remove duplicate values did : $serveur = $serveur | sort -uniq so when display array, obtain these 2 values : dexter , gordon , third null value but empty value the following code return 3 $serveur.count why? thanks help if want exclude empty values can this $serveur = $serveur | ? { ...

java - How to get SD card events? -

i'm building app monitors phone usage. need implement sqlite db necessary application running. because not devices have emmc, need check if device have emmc , if not need check if sd card available. (if emmc not present, other place blackberry let me put db sd card). i need know how check if sd card present , how many free space has , need implement "listener" check hot sd removal event , similar. someone can help? thanks. filesystemregistry has static method can add custom filesystemlistener implementation. let know when sd card added or removed.

ios - Can't do ANYTHING with navigation bar -

Image
i have structure: when want add ´uinavigationitem´ storyboard navigation bar "disabled", tried add right button programatically: uibarbuttonitem *button = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action:@selector(showpickerview:)]; self.navigationitem.rightbarbuttonitem = button; but nothing happens. renamed navigation bar title storyboard, when run app title not set. don't know source of problem. there button appearing. thank help. each item in tab bar controller should have navigation controller root controller (well, don't need of them have nav controller if don't need them). have tab bar controller in navigation controller (unless it's modal) view controllers contained in tab bar controller can't see out navigation controller.

MySQL Master Slave Replication only seems to be updating the binary logs on the slave -

i have strange issue, i've setup master / slave replication slave being percona cluster node. everything seems running correctly no data appears in slave databases , data files not growing on slave. oddily though can see filesize of binlogs growing quite lot on slave (nothing else runs on server @ moment). my question this.. during master / slave replication innodb / xtradb cache amount of data in slave's binlogs before flushing actual database? if can configurre "flushing". many thanks binlog files not directly used galera replication, subsystem (for own replication protocol). make sure have have activated log-slave-updates on slave. additionally, although should work default statement format, due problems found in past (autoincrement values working differently in galera), recommend doing replication in row format. if doesn't work, can try else (are binary logs increasing or relay logs increasing? -log slave updates should not default; ...

asp.net - Does the SignalR RouteTable.Routes.MapHubs(); absolutely have to be put in Application_Start()? -

can put in other custom named methods within global.asax start first onapplicationstarted()? dilemma i'm having our project has custom class class in global.asax inheriting instead of standard "system.web.httpapplication". means can't use "application_start" method put signalr hubs routing in. so question this: signalr absolutely hardwired use method exact method name of "application_start" in global.asax? thanks! maphubs creates signalr/hub script. doesn't matter generate long generated before attempt use script.

asp.net mvc - MVC actionlink parameter never sending -

can tell me why parameters in following code null when controller action called: <% foreach (var row in model) { %> <tr> <td><%=html.actionlink("edit", "edit", "customer", new { controller = "customer", action = "edit", id = row.customerid })%>| <%= html.actionlink("sales", "list", "sale", new { controller = "sale", action = "list", id = row.customerid }, null)%></td> <td><%= html.encode(row.customerid)%> </td> <td><%= html.encode(row.firstname)%> </td> <td><%= html.encode(row.lastname)%> </td> <td><%= html.encode(string.format("{0:g}", row.dateofbirth))%></td> <td><%= html.encode(row.address)%> </td> <td><%= html.encode(row.phone)%> </td> </tr> ...

Freebase Output JSON result parsing in C# -

i've began using freebase api , i'm trying parse json result object c#. i'm getting fine output field. for example, using freebase's output usage example: { "status": "200 ok", "result": [ { "mid": "/m/017n9", "id": "/en/blade_runner", "name": "blade runner", "notable": { "name": "future noir film", "id": "/m/0279xh5" }, "lang": "en", "score": 180.628250, "output": { "contributor": { "/film/film/cinematography": [ { "mid": "/m/0fxgcv", "name": "jordan cronenweth" } ], "/film/film/costume_design_by": [ { "mid": "/m/0...

c - Rather than bubblesorting these names...the program crashes -

i doing wrong but, life of me, can't figure out what. int main(int argc, char *argv[]) { int done=0; int end=0; int didswap=0; char *temp[2] = {0}; int i; int x; printf("this function bubble sorts flintstones in alphabetical order!\n"); printf("the flintstones names are:\nfred\nbarney\nwilma\npebbles\ndino\n"); char *names[5] = {0}; names [0] = "fred"; names [1] = "barney"; names [2] = "wilma"; names [3] = "pebbles"; names [4] = "dino"; while(end == 0) { for(i=0;i<4;i++) { if (strcmp(names[i],names[i+1])>0) { strcpy(temp[0],names[i]); strcpy(temp[1],names[i+1]); strcpy(names[i],temp[1]); strcpy(names[i+1],temp[0]); didswap = 1; } else { didswap = 0; } ...

ios - Animate UICollectionViewCell Reloading -

i have looked over, without luck. i'll keep short , sweet. feel should looking @ uicollectionviewlayout , not entirely sure. i want achieve: custom animation uicollectionviewcell when data reloaded. e.g. cell contents spirals in (as example). how can achieve this? thanks! you use activity indicator view. code like: [youraiv startanimating]; [yourcollectionview reloaddata]; [youraiv stopanimating];

javascript - Jquery focus/submit acting weird in Chrome-Browser -

actually ( on website ) have form in box. not exhaust limited place in box, contact-form pops full size, when inputs (textarea, select, too) gets focused. when submit button gets hit, ajax request gets fired up. under firefox works great. in chrome: when click submit button, form gets usual size , no ajax-request gets fired. please feel free check out self: http://jsfiddle.net/uugaz/ the actuall code-parts involved: js $('#helpkontakt').submit(function(){ alert('on way!'); }); $("#helpkontakt textarea, input, select").focus(function() { $("#helpkontakt").css("height", "auto"); }); $("#helpkontakt textarea, input, select, #submit").focusout(function() { $("#helpkontakt").css("height", "200px"); }); html <form action="" accept-charset="utf-8" role="application" class="ym-form ym-columnar clearfix" method="...

c# - LINQ: search 2 properties for a list of strings -

i have following in varies parts of code: questionmodel: public class questionmodel { public string question { get; set; } public string answer { get; set; } } keywords: list<string> searchkeywords questions: list<questionmodel> questions what achieve list of questions, search , retain questions have keywords. i'm gone far hit road block: var questions = getallquestions(); //returns questions list<questionmodel> questions = questions.all(x => searchkeywords.all(k => x.question.contains(k) || x.answer.contains(k))); this returns bool. any or directions appreciated. you using wrong linq method, want where instead of all : questions = questions.where(x => ...); all tells if every item in collection satisfies condition (boolean result); where filters elements satisfy condition (filtered collection result). depending on questions (looks property, of type?) may have wrap tolist or toarray .

osx - How can I decode this text file? -

i started playing call of duty 4 on computer(mac). the game keeps multiplayer data/stats in text file named "mpdata". have complete access , can change data. the issue it's encoded in macroman. can change type of encoding in program called hex fiend. basically, i'm confused on how can decode it. help? go applications. go utilities. click on terminal. terminal enter: python copy , paste text had your_mac_roman_text, , paste terminal. 'your_mac_roman_text'.decode('mac-roman')

spi - Beaglebone Linux: issues appending a line to a file -

i working enable spi on beaglebone black (angstrom distribution), using instructions here. i @ point need add bb-spi1-01 /sys/devices/bone_capemgr.*/slots enable drivers. issuing command echo bb-spi1-01 > /sys/devices/bone_capemgr.*/slots or echo bb-spi1-01 >> /sys/devices/bone_capemgr.*/slots , however, yields error echo: write error: file exists trying edit in line nano fails. i'm able open file , edit it, when save gives me error writing slots: no such file or directory i've set permissions on file 777. does know why cannot edit file? if it's not possible, there workaround? i, have battled dilemma while trying port ili9340c display stuff beaglebone black. way /dev/devices/bone_capemgr.* works echo slots directory goes , searches device tree overlay device, new thing in linux kernel 3.0 , higher. not know (it took me forever find this) device trees driver tells linux how deal device, instead of containing code, configuration file, per-...

wpf - Is it possible to dynamically create checkbox and specify itsgroupbox/grid and location in C# only? -

i trying create large number of checkboxes , felt not efficient if created them in xaml. is possible dynamically create checkboxes , specify group box/grid , location in c# only? know can dynamically create check boxes not sure how manage location via c#. i relatively new wpf, thanks! most have page has content property should able following stackpanel panel = new stackpanel(); this.content = panel; panel.children.add(new checkbox()); panel.children.add(new checkbox()); panel.children.add(new checkbox()); i guess can reference them following checkbox cb = new checkbox(); panel.children.add(cb);

c# - Get the assembly path but not the temporary path where the assembly is running -

i breaking head simple unit testing writing! [testfixture] class { [testmethod] public void test() { assembly.getexecutingassembly().location // gives temporary local path } } all want path of assembly location (where project folder resides) not local or temporary folder. this folder if put breakpoint: \appdata\local\temp\ any appreciated! edit: tried doing both nunit mstest microsoft's unit testing! nothing helps. did try appdomain.currentdomain.basedirectory

sql - How to do nested select in MongoDB -

how one, in mongodb, implement following sql statement? select count(*),t1.a,t1.b t1, t2 (t1.id = t2.t1_id) , (t2.t1_id in (select id t1 order id desc limit 10)) group 2,3 order 1 desc i figured out how except nested select. i'm running outer select in loop using "$in" each value of nested select. java code follows: basicdblist t1list = new basicdblist(); dbobject inclause = new basicdbobject("$in", t1list); dbobject t2query = new basicdbobject("t1s", inclause); dbobject nextt2; (int query = 0; query < 10; query++) { system.out.printf("running query %d - ", query); dbcursor top_ten_t1s = t1coll.find().sort(new basicdbobject("v", -1)).limit(10); while (top_ten_t1s.hasnext()) { nextt2 = top_ten_t1s.next(); t1list.clear(); t1list.add(new long(nextt2.get("_id").tostring())); int thecount = t2co...

android - LocationManager and LOCATION_SERVICE -

are these 2 lines equivalent? behave differently in application. locationmanager = (locationmanager) context.getsystemservice(location_service); locationmanager = (locationmanager) getsystemservice(context.location_service); thanks yes same, first other activity or service while other 1 of 2.

I can't access unc path from C#. Getting access is denied -

i'm using windows server 2008 , iis 7.5 i'm trying access file way: \server\c$\temp\testfile.log c# code running on server. my username admin on both servers. code running under account. temp folder has been set full rights (my user) , asp.net. why can't access it? i can't shared folder; against rules. running under full account; therefore, don't need impersonation, right? is web app? sure app impersonating account? anonymous access set true in iis?

php - How to get pump.io OAuth consumer key? -

i'm working on web application php , need communicate pump.io servers through activity stream api. perform subsequent operations need authenticate via oauth , needs oauth consumer key, problem couldn't find procedure on pump.io servers generate key, @ least i'm not aware of such thing. ? i not full expert of pump.io, there model called accesstoken . ( https://github.com/e14n/pump.io/blob/master/lib/model/accesstoken.js ) i seems have method random token generated. (lines 65-67)

c# - It is possible to use DataTables Column Filter Add-on with a Gridview -

i trying use datatables column filter add-on on gridview table using sql datasource not coming luck. have gridview render header , footer can not add footer. <%@ page language="c#" autoeventwireup="true" codefile="glossary.aspx.cs" inherits="home.glossary" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title spellcheck="true">glossary</title> <style type="text/css" media="all"> @import "datatables-1.9.4/datatables-1.9.4/media/css/jquery.datatables_themeroller.css"; #form1 { width: 100%; } </style> <script src="datatables-1.9.4/datatables-1.9.4/media/js/jquery.js"></script> <script src="datatables-1.9.4/datatables-1.9.4/media/js/jquery.datatables.js"></script> <script s...

jsp - c:param does not append the expected value, it appends %24%7bkey%7d instead of evaluated value of ${key} -

the following not working <%session.setattribute("key", ${key});%> <c:redirect url="/example/request/first.jsp"> <c:param name="send" value="done"/> <c:param name="key"><%= session.getattribute("key") %></c:param> </c:redirect> result: "send=done&key=%24%7bkey%7d" how pass session attribute in correct value come across? *update - happening saving uploaded file directory on server. don't know how accomplish using ajax call using form post method. my ajax call saves record database executing before form post key(for record) lost once forwarded jsp page taking care of file upload. i trying redirect main page there preserving key can load record user. hoping maybe session data accomplish me keeping key ajax call form post. messy know... solution needs work on @ least internet explorer 8. why mixing taglibs/el oldschool scriptlet...

git - Merging the latest copy of the master into another branch -

i new git , started working on new branch. want make sure have latest copy of master on computer i.e changes others made in master, has merged test branch. tried git pull origin master updates master branch, how ensure test branch updated? want make sure changes made don't accidentally merge master unless want to. first have switch master branch, so git checkout master now perform git pull origin master once master branch updated can switch test branch , merge git checkout testbranch git merge master this update branch latest master. hopefully helps!

unix - Dealing with cat and head in a bash loop -

i trying add 2 lines of text 1 file beginning of bunch of other files using loop in bash command line. i tried in command line: $for in *.txt; head -2 ../../041_r_def_c.txt > x; cat >> x; \mv x i; done but gives me error: cat: i: no such file or directory i tried move 1 line beginning of files: $for in *.txt; echo "#c wavelength d %4.0f angstrom"|cat - > /tmp/out && mv /tmp/out i; done cat: i: no such file or directory cat: i: no such file or directory cat: i: no such file or directory i thought carry name of .txt file, don't think is. how can carry name of file/play role of file? in loop, i variable, need access contents of variable $ , should cat $i >> x . otherwise, thinks want cat file named i , doesn't exist. $i gives name stored inside variable i . you run same issue mv ... want \mv x $i

vba - How to make a option in a macro in word selected by default? -

i have following macro in word 2010. make value 1 (copenhagen) preselected when run macro - put content control drop down list in document copenhagen preselected. how do ?: sub cities() ' ' cities macro ' ' selection.range.contentcontrols.add (wdcontentcontroldropdownlist) selection.parentcontentcontrol.title = "cities" selection.parentcontentcontrol.lockcontentcontrol = false selection.parentcontentcontrol.dropdownlistentries.add text:="copenhagen", value:="1" selection.parentcontentcontrol.dropdownlistentries.add text:="new york", value:="2" selection.parentcontentcontrol.dropdownlistentries.add text:="london", value:="3" selection.parentcontentcontrol.dropdownlistentries.add text:="paris", value:="4" selection.moveright unit:=wdcharacter, count:=1 end sub thanks in advance! / anders h. did study the documentation ? word 2013 more detailed 2010 version of pag...