Posts

Showing posts from May, 2012

sql server 2008 - SQL Basic Concurrency -

insert t1 (xfield) select 7 xfield (select count(*) t1) = 0 basically, if million users run @ same time, there ever end being more 1 row in t1? thread a: select count(*) t1: 0 thread b: select count(*) t1: 0 thread a: insert t1... thread b: insert t1... or guaranteed never happen, because it's 1 statement? if isn't safe, this? table t2 (gonorth , gosouth must never both 1): id gonorth gosouth 1 0 0 then happens: user a: update t2 set gonorth = 1 gosouth = 0 user b: update t2 set gosouth = 1 gonorth = 0 thread a: find rows gosouth = 0 thread b: find rows gonorth = 0 thread a: found row gosouth = 0 thread b: found row gonorth = 0 thread a: setting gonorth = 1 located row thread b: setting gosouth = 1 located row and result: id gonorth gosouth 1 1 1 what rules can happen @ same time , can't? my database engine "microsoft sql server 2008 r2 (sp2)". no. it's written single statement, ,

sql - How can I tell Django to execute all queries using 10MB statement mem? -

i'm using django postgresql database. i'm having limited access database configuration , can't alter postgresql.conf . however if want execute queries through django specified statement_mem settings 10mb. i tried using cursor.execute("set statement_mem='10mb'") - working how can write in generic way - each every api calls go using setting? wrap cursor in own class executes cursor.execute("set statement_mem='10mb'") on every call otherwise mimics cursor class. "monkeypatch" real cursor class too, confusing.

WPF 4.5 Microsoft's Ribbon: which control of RibbonApplicationMenu -

Image
i using microsoft's ribbon of wpf 4.5 , developing application using vs2012 (c#) on win 8 machine. want make application show ribbonapplicationmenu "file"-menu of office word 2010, can't find out control used (see attached screenshot, red-marked control number 1 , 2). tried ribbonapplicationsplitmenuitem more office old-style. maybe can tell me. thank in advance. 1) suggest use ribbon that's inside .net 4.5 (add reference system.windows.controls.ribbon). i'm not sure used external one. 2)what need menu ribbon.applicationmenu 3) below working ribbon (based on that) includes several types of buttons menu require. need work add images folder "options.png" in it. <window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350"

How to import Russian character in magento by CSV -

Image
i need import russian product name csv ib magento showing "????" replace of russian word. if there solution, me. thanks magento doesnot allow special character importing customer data generally.. example in dutch translation special characters not (always) show properly. if have import data jaydéép through csv of magento import shows error best practice go .htaccess file , remove # adddefaultcharset utf-8 , open csv file in .txt format , save under utf-8 , import data in magento special character import in magento admin without error.

python - Checking uniqueness contraint during form validation in App Engine -

i using flask , wtforms in app engine, trying implement uniqueness contraint on 1 of field. question big, please patient , have been stuck here many hours, need people. started learning app engine, flask , wtforms month ago. in advance. application has model 'team' shown below: class team(db.model): name = db.stringproperty(required=true) -- other fields here -- requirement: name of team has unique. i have followed links http://www.codigomanso.com/en/2010/09/solved-anadir-claves-unicas-en-google-app-engine-en-3-lineas/ http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/ http://csimms.botonomy.com/2012/07/there-are-only-two-ways-to-enforce-unique-constraints-in-google-app-engine.html have come following code: models.py: created separate table 'unique' given in link: class unique(db.model): """ handles uniqueness constriant on field """ @classmethod def unique_check(cls, form_name,

class - Trouble with abstract classes in c++ -

main: #include <iostream> #include <string> #include "servicechargechecking.h" int main() { servicechargechecking newaccount("crim", 111222, 50.00, 100, 1.00); system("pause"); return 0; } servicechargechecking.h: #ifndef h_servicechargechecking #define h_servicechargechecking #include "checkingaccount.h" #include <string> class servicechargechecking: public checkingaccount { public: void setmonthlyfee(double); void writecheck(int); void getmonthlystatement() const; servicechargechecking(std::string =" ",int = 0, double = 0.00, int= 0, double = 0.00); private: double servicecharge; }; #endif servicechargechecking.cpp: #include "servicechargechecking.h" #include <iostream> using std::string; void servicechargechecking::setmonthlyfee(double fee) { servicecharge=fee; } void servicechargechecking::getmonthlystatement() const { checkingacco

Facing calculator app error in android -

friends searched lot didnt answer of question. trying make android calculator. simple 1 , single module of bigger app... in firstly need users enter 1st , 2nd sunber , select if add, sub, mul, divide or mod..then there textview in result displayed. this code using : java code: package com.droidacid.apticalc; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class numsys extends activity{ edittext etnumber1; edittext etnumber2; button badd; button bsub; button bmul; button bdiv; button bmod; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.numsys); etnumber1 = (edittext) findviewbyid(r.id.number1); etnumber2 = (edittext) findviewbyid(r.id.number2); string number1 = etnumber1.gettext().tostring(); stri

C# 2Gb file is 4gb in Ram. Why? -

im reading in file(this file consists of 1 long string 2gb in length). this function read contents of file memory , splits string , places: *reader = streamreader public list<char[]> getallcontentaslist() { int bytestoread = 1000000; char[] buffer = new char[bytestoread]; list<char[]> results = new list<char[]>(); while (_reader.read(buffer, 0, bytestoread) != 0) { char[] temp = new char[bytestoread]; array.copy(buffer,temp,bytestoread); results.add(temp); } return results; } when data in placed list takes 4gb in ram. how possible when file 2gb in size? *edit this ended doing. im not converting array of bytes string, im passing bytes on manipulating them. fiel 2gb in mem instead of 4gb public list<byte[]> getallcontentaslist() { int bytestoread = 1000000;

Email HTML document, embedding images using c# -

so here situation. i need send email string in html format has images embedded in it. tried converting images base64 not work. the email has 3 images type system.drawing.image. need them in html formatted string. you right converting base64, not enough embed (there no way client distinguish base64 plain text), need format bit. check out buhake's answer, covers problem in general (you should able take there): how embed images in email

c# - Deleting a large number of records takes a VERY long time -

i have database table (running on sql server 2012 express) contains ~ 60,000 rows. i using following code purge old rows: //deleting cpu measurements older (oldestallowedtime) var allcpumeasurementsquery = curr in msdc.cpumeasurements curr.timestamp < oldestallowedtime select curr; foreach (var cpumeasurement in allcpumeasurementsquery) { msdc.cpumeasurements.remove(cpumeasurement); } when number of deleted rows large (~90% or more of records in tables being deleted) operation takes exceptionally long. takes 30 minutes finish operation on relatively strong machine (intel i5 desktop). does seem normal behavior? any ideas can reduce operation's time? thanks, entity framework not @ handling bulk operations this. should use executestorecommand execute sql directly against data source in situations this. var deleteold = "delete cpumeasurements curr.timestamp < {0}"; msdc.executestorecommand(deleteold, oldestallowedtime); by doing don

c++ - Deciding about constructed objects at compilation time -

i have following problem solve. i have component a. component has sub-components - b,c,d. using cmake building or not b,c,d components. depends on current platform configuration. cmake system making executable makefiles (for component) linking components, used in given cmake run. if component b built, added executable if not - not linked. same other - c,d. all b,c,d components provide implementations of interface used in component. component shall manage objects created b,c,d , keep objects in map, using proper object @ proper time. question: i want achieve simple , reliable mechanism adding objects implementing interface automatically, same linking - linked modules, built. same objects - have them registered in component when compiled. it hard me explain it. idea easy - build map of objects @ compilation time. components compiled shall deliver object map . i have used designs similar how objective-c , smalltalk implement methods. in c++, methods == member func

java - Creating dependencies from directory -

does know tool create maven dependencies lib directory? have several web projects quite lot of jars , "mavenize" them. looking proper dependency each 1 quite pain , seems may solved program. ant2ivy https://github.com/myspotontheweb/ant2ivy groovy script can this. despite name, can create pom files ( https://github.com/myspotontheweb/ant2ivy/commit/9e3e8358f2b31507b13f5def69627da422e1656b ). it looks names/hash in maven central in order create pom.

javascript - Set Field from parent from child's iframe -

i have web page opens search page shows results in iframe. upon selection of particular search result, want send value search page's iframe opening page , close search page. how do this? parent.opener.document.getelementbyid("street1").value = street1;

java - Jackson XML - deserializing XML with namespace prefixes -

i'm working jackson xml plugin ( https://github.com/fasterxml/jackson-dataformat-xml ), , i'm not sure if it's supported, i'm wondering if it's possible both serialize , deserialize xml namespace prefixes, so: <name:foo> <name:bar> <name:x>x</name:x> <name:y>y</name:y> </name:bar> </name:foo> i can generate type of xml using jackson's plugin so: @jacksonxmlproperty(localname="name:bar") public bar getbar() { return bar; } however, can't find way configure pojos deserialize xml generated. please see following example code: public class bar{ @jacksonxmlproperty(localname="name:x") public string x = "x"; @jacksonxmlproperty(localname="name:y") public string y = "y"; } @jacksonxmlrootelement(localname="name:foo") public class foo{ private bar bar; @jacksonxmlproperty(localname="nam

jsf 2 - Unable to attach AddRemoveListener to UIViewRoot because it is null/ The view can not be restored errors with jsf2.0 and openam -

i have jsf 2.1 application, developed using primefaces 3.4, working fine.the problem appears when add agent filter glassfish 3.1 server. have "unable attach addremovelistener uiviewroot because null" error when click button in glassfish console. similar problem? web.xml <filter> <filter-name>agent</filter-name> <filter-class>com.sun.identity.agents.filter.amagentfilter</filter-class> </filter> <filter-mapping> <filter-name>agent</filter-name> <url-pattern>/*</url-pattern> <dispatcher>request</dispatcher> <dispatcher>include</dispatcher> <dispatcher>forward</dispatcher> <dispatcher>error</dispatcher> </filter-mapping> errors in glassfish console: attention: unable attach addremovelistener uiviewroot because null attention: standardwrappervalve[faces servlet]: pwc1406:

excel - Error " 91" Object variable or With block variable not set -

hi guys totally new vba , i'm trying set value of cell 1 of function parameters. code giving error 91. 6th line in code raising error. i'm unable resolve , please can me . thanks in advance. sub report_file(a, r_row) dim wb_dst workbook dim ws_dst worksheet set wb_dst = workbooks.open("f:\projects\vba_excel\report.xlsx") ws_dst = wb_dst.sheets(1) ws_dst.cells(r_row, 2).value =a end sub the error line is. ws_dst.cells(r_row, 2).value =a option explicit sub report_file(a, r_row) dim wb_dst workbook dim ws_dst worksheet set wb_dst = workbooks.open("f:\projects\vba_excel\report.xlsx") set ws_dst = wb_dst.sheets(1) ws_dst.cells(r_row, 2).value = if = "savior" wb_dst.cells(r_row, 2).value = end if end sub

python - Average over a relationship in django -

i have 2 entities, namely project , issue defined followed: class project(models.model): class issue(models.model): project = models.foreignkey(project, related_name='issues') progress = models.integerfield(default=0) i'd have progress method in project model return average of related issue progress. i tried following i'm getting related issue list. def progress(self): return self.issues.annotate(models.avg('progress')) thanks help. what want is: def progress(self): aggregate = self.issues.aggregate(models.avg('progress')) return aggregate['progress_avg'] if intend show progress of each project in project list view, use like: for project in project.objects.annotate(progress_avg=models.avg('issues__progress')): print project.progress_avg the latter example better list view, since avoids n+1 problem (1 aggregation query each project in list).

javascript - Call Function on View Loaded (Activate) in Hot Towel/Durandal Single Page App -

i'm using hot towel spa project i'm trying call simple js function when view activated. i'm seeing item not seem loaded when activate function called. i've tried putting code in initialize function called activate suggested on other posts. not seem help. so recommended method in durandal/hottowel calling function on view load? home.js (view model) define(['services/logger'], function (logger) { var vm = { activate: activate, title: 'home' }; return vm; function activate() { logger.log('home view activated', null, 'home', true); return init(); } function init() { $("#backbtn").hide(); console.log($("#mybtn").html()); // returns undefined } }); home.html (view) <section> <div id="mybtn">test</div> </section> when durandal attaches view model looks on model viewattached met

Is there a way to create a dynamically object literal value in JavaScript? -

in other words, let value variable. this: var a=3,b=4; var obj = {x : a, y : b}; alert(obj.x); //will display '3' a=2; alert(obj.x); //want display '2' - how can accomplish this? make method: var = 3, b = 4, obj = { x: function () { return a; }, y: b }; = 2; and call like: obj.x() // returns 2 demo: http://jsfiddle.net/67nwy/2/ otherwise there's no native (and supported in older browsers) way "live" value of a using obj.x . answer here provides use of object.defineproperty can this. you can apply obj.y well, if wish same.

ruby on rails - client_side_validations and devise error messages -

Image
im validating form client side validations , have devise, in form: <fieldset> <div class="control-group"> <%= f.label :current_password, "old password:", :class => "control-label" %> <div class="controls"> <%= f.password_field :current_password %> </div> </div> <div class="control-group"> <%= f.label :password, "new password:", :class => "control-label" %> <div class="controls"> <%= f.password_field :password %> </div> </div> <div class="control-group"> <%= f.label :password_confirmation, "new password, again:", :class => "control-label" %> <div class="controls"> <%= f.password_field :password_confirmation %> </div> </div> </fieldset> and have in model v

visual studio 2010 - How to use MasterPage for WebPage in SubDirectory? -

Image
parser error or master page error? i have website masterpage in visual studio 2010 project. i have many webforms located in subdirectories, question focus on subdirectory called /contact . in vs2010, of webforms in /contact directory display supposed using page directive code: <%@ masterpagefile="~/site.master" ... %> it understanding ~/ supposed direct page root folder. yet, when go page in folder, parser error saying masterpage not exist because page attempting load masterpage here: '/contact/site.master' if modify vs2010 project page directive tries step root level, vs project give me master page errors. does not work: <%@ masterpagefile="../~/site.master" ... %> also not work: <%@ masterpagefile="~/../site.master" ... %> what trick here? something wrong in visualstdio @ end. i pretty sure doing correct. i tried creating asp.net project, added folder called contact , dragged

java - InetAddress.getLocalHost().getHostAddress() is returning 127.0.1.1 -

this question has answer here: java inetaddress.getlocalhost(); returns 127.0.0.1 … how real ip? 9 answers my question similar this question . want real ip of machine (not 127.0.0.1) strange, below code in ubuntu returning 127.0.1.1 inetaddress.getlocalhost().gethostaddress() below complete code, posted in @ here public string getmachineip() { try { string hostip = inetaddress.getlocalhost().gethostaddress(); if (!hostip.equals("127.0.0.1")) { return hostip; } /* * above method returns "127.0.0.1", in case need * check available network interfaces */ enumeration<networkinterface> ninterfaces = networkinterface .getnetworkinterfaces(); while (ninterfaces.hasmoreelements()) { enumeration<inetaddress> inetaddresse

objective c - While (not) loop freezes app -

my while loop doesn't seem work. when loading view, app freezes. when delete part of code, containing while loop, app won't freeze. what i'm searching piece of code cause same array not chosen twice. @interface thirdviewcontroller () @end @implementation thirdviewcontroller ... nsstring * answer = @""; nsarray * ramarray; ... - (void)newquestion { nsstring * pliststring = [[nsbundle mainbundle] pathforresource:@"questions" oftype:@"plist"]; nsmutablearray * plistarray = [[nsmutablearray alloc]initwithcontentsoffile:pliststring]; nsarray *plistrandom = [plistarray objectatindex: random()%[plistarray count]]; while (![plistrandom isequal: ramarray]) { nsarray *plistrandom = [plistarray objectatindex: random()%[plistarray count]]; } ramarray = plistrandom; ... } - (void)check:(nsstring*)choise { ... if ([choise isequaltostring: answer]) { ... [self newquestion];

wpf - Add record to DB using LINQ to SQL? dont save record in DB -

i using using linq sql. when adding new record db show add taking record, close app , go db, no record were, if add manualy in db , retrieve data. why can retrieve data, not save data add. my add method public void insertkelias(kelias kelias) { db13datacontext context = new db13datacontext(); context.kelias.insertonsubmit(kelias); context.submitchanges(); } get data metod public list<kelias> kelias() { db13datacontext context = new db13datacontext(); return context.kelias.tolist();; }

javascript - With bind/on change how to show a Row -

i have form using coldfusion using binding generate value. after user selects pull down selection automatically generates value 'y' or 'n' generated table. need use value, in case if value 'y' display more questions answered. here current coding looks like. <td>select category: <cfselect name="catdesc" title="select category generate related services" bind="cfc:servicetype2.cat_description()" bindonload="true"/><br /> </td> </tr> <tr id="serv_ty2" style="display: inline;"> <td></td> <td>select service: <cfselect name="service_type" bind="cfc:servicetype2.getservicetype2({catdesc})" bindonload="false"/></td> </tr> <tr id="lr_verify" style="display: inline;"> <td></td> <td>labor relations

c++ - std::find Object by Member -

scenario i’ve run speedbump while using stl seems normal scenario, simplified here: class person { string name; int age; }; vector<person> people; addpeople(people); string s("bob"); find(people.begin(), people.end(), s); problem unfortunately find wants compare entire class. question there better or more appropriate way “stl way”? suggested questions weren’t helpful, managed find couple of related questions no direct solution. work-arounds/tests there’s potential work-arounds: forgo find altogether (cluttered, refactored): bool bbob = false; (uint = 0; < people.size(); i++) { if (people[i].name == s) bbob = true; break; } provide conversion operator (implicit conversion doesn’t work; explicit can’t used in find ): class person { string name; int age; operator string() {return name;} }; person b ("bob", 99); string s ("bob"); b == s; //doesn’t work string(b) == s; //works, no

callback for facebook share button using addthis -

i using addthis facebook share option. <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> when user completes facebook sharing need functionalities. so guys please me on how can callback after successful sharing. addthis provides way detect when user clicks sharing: http://support.addthis.com/customer/portal/articles/381263-addthis-client-api#events this doesn't guarantee user shared page (there isn't way across different networks without doing share server side api). closest way accomplish want.

theory - Engineering impossible bugs? -

how engineer impossible bug? possible? take simple example: bob needs add commenting functionality popular internet blog. gets millions of visitors month , has thousands of posts. how implement feature if hired you? you add form @ end of page responsible rendering posts, right? common sense. (forget security sake of simplicity) however, solution assumes way how bob's blog works. let's person made bob's blog hated bob. wanted make system no new features implemented without rewriting scratch. how create system if 1 hated bob? aren't limited specific language, framework, operating system, server software, architecture, or anything. need provide working blog pages clients connect server. also assume bob whatever tell him to. if has send in new hand-written blog posts carrier pigeon offshore processing center, it. and before asks, no, not asking question because want screw on client. think of exercise. we're used engineering code isn't supposed br

php - What do I put in date_default_timezone_set? -

i'm not want use date_default_timezone_set , set englewood, colorado. use? can't find america/englewood or america/colorado in the documentation . help? as google tells me colorado in 'mountain time zone' use us/mountain documentation

debugging - Interface of an element in JavaScript -

in chrome, when debugging in javascript, interesting interface of element. typing variable name holds element in console gives me element tag. how can interface matching element. chrome outputs it, gives tag. unsure how chrome returns value. browsers try smart when displaying things via console.log make output more readable. if want consistently tree of properties can navigate through, can use console.dir . interface has no meaning in js , specific meaning in other languages. can potentially see webidl interface of dom element viewing prototype of element using console.log(element.__proto__); entirely browser dependent , non-standard.

forms - One text input and a submit button in scala -

i'm looking solution accomplish same thing in similar question: html forms java play framework 2 but in scala. there way this? have 1 text field , submit button. want value text field when pressing button , pass value backend code. basically, set view & form same way in html forms java play framework 2 , , put in controller. object mycontroller extends controller { case class submission(value: string) val submissionform = form( mapping( "value" -> text )(submission.apply)(submission.unapply) ) def myaction = action { implicit request => submissionform.bindfromrequest().fold( formwitherrors => { // bad form, reshow view ok("got bad form") }, submission => { // submitted form ok("got " + submission.value) } ) } } play 2.1 forms documentation

java - I am getting an error on the test for some classes I wrote but I cant figure out what I did wrong? -

public class cellphone { //reminder: protected fields can accessed directly // class extends 1 protected string ownername; public cellphone(string ownernamein) { //initialize ownername ownernamein ownername = ownernamein; } public string receivecall(cellphone sender) { //return string of form: // receiver's name " receiving call " sender's name //you can implement using receiver invoke receivecall // while passing in current phone string receivecall = sender.ownername + " receiving call " + ownername; return receivecall; } public string call(cellphone receiver) { //return string using receiver invoke receivecall // while passing in current phone return this.receivecall(receiver); } } package cellphones; public class textmessagingphone extends cellphone { //number of messages owner can send , receive //

ios - Using OCMock with Unknown Number of Method Calls -

i'm using ocmock in junction ghunit try , recreate graham lee's "browseoverflow" project test-driven ios development. my understanding mock object isn't current class testing. working question class relies on answer class functionality. questsion.h @class answer; @interface question : nsobject { nsmutableset *answerset; } @property (retain) nsdate *date; @property nsinteger score; @property (copy) nsstring *title; @property (readonly) nsarray *answers; - (void)addanswer:(answer *)answer; @end question.m #import "question.h" #import "answer.h" @implementation question @synthesize date; @synthesize score; @synthesize title; - (id)init { if ((self = [super init])) { answerset = [[nsmutableset alloc] init]; } return self; } - (void)addanswer:(answer *)answer { [answerset addobject:answer]; } - (nsarray *)answers { return [[answerset allobjects] sortedarrayusingselector:@selector(compare:)]; }

html - jQuery not loading in asp.net page -

i making asp.net page in sharepoint 2010, , trying load jquery files. near top of page have this: <sharepoint:cssregistration id="jquery_css" name="/_layouts/pdf library/blitzer/jquery-ui-1.10.3.custom.min.css" runat="server" enablecsstheming="true" after="true" /> <sharepoint:scriptlink id="jquery_js" name="/_layouts/pdf library/jquery-2.0.0.min.js" runat="server" ondemand="false" localizable="false" /> <sharepoint:scriptlink id="jquery_ui_js" name="/_layouts/pdf library/jquery-ui-1.10.3.custom.min.js" runat="server" ondemand="false" localizable="false" /> and near middle of page have this: <asp:panel id="help_panel" runat="server"> click <a href="#" onclick="$(this).next().slidedown();" title="click show details">here&

c# - Is there a better way to do this ? -

so here goes. have model of dataset works fine , imports data database , gives crystal report. solution works time consuming wondering if there other way of doing this... using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using oracle.dataaccess.client; using system.data; using crystaldecisions.crystalreports.engine; using crystaldecisions.shared; namespace webapplication1 { public partial class webform1 : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void button1_click(object sender, eventargs e) { string connetionstring = null; oracleconnection connection; oracledataadapter oracleadapter; dataset ds = new dataset(); string firstsql = null; connetionstring = "datasoruce"; connection = new oracleconnectio

append variable from multiple function which call ajax requests -

i having trouble setting markup variable multiple ajax requests call functions. number of function not know, example made 2 , put them in same js file. trying loop though unknown number of functions , append markup variable response. however ajax request isn't finished before function ends. how can make sure response ajax before proceeding? getmarkup() run on document.ready function getmarkup(){ var news = []; news.push('loadnews1'); news.push('loadnews2'); len = news.length; var markup; for(i=0; i<len; i++){ try{ markup = eval(news[i] + '();'); }catch(ex){ } } console.log(markup); } function loadnews1(){ var host = 'http://test.com'; var path = '/ajax-feeds/news/json1'; var markup = ""; $.ajax({ url: host + path, datatype: "json", async: true, success: function(data) { $.each(

java - json-simple How to get value from index? -

i want value json based on index. code bellow working value string reference. string s="{\"ga087sh85izetri-123872\":\"0\",\"ga087sh85izetri-123873\":\"-1\",\"ga087sh85izetri-123874\":\"0\",\"ga087sh85izetri-123875\":\"-1\",\"ga087sh85izetri-123876\":\"0\",\"ga087sh85izetri-123877\":\"0\",\"ga087sh85izetri-123878\":\"0\",\"ga087sh85izetri-123879\":\"0\",\"ga087sh85izetri-123880\":\"0\",\"ga087sh85izetri-123881\":\"0\"}"; jsonparser parser2 = new jsonparser(); object objs = parser2.parse(s); jsonobject jsonobject2 = (jsonobject) objs; system.out.println(jsonobject2.get("ga087sh85izetri-123873")); i'm lookin way like: system.out.println(jsonobject2.get(0)); in json-simple, jsonobject extends hashmap: http://juliusdavies.ca/json-simple-1.1.1-javadoc

php - using array merge into a foreach loop -

i need merge new array of alternative information loop if have alternative information in profile. here's loop: foreach ($doctor->getvars() $k => $v) { $data['doctor_'. $k] = $v; } foreach ($patient->get_data() $k=>$v) { if (is_string($v) || is_numeric($v)) $data["patient_" . $k] = strtoupper($v); } here's $data var_dump: array ( [employee] => person [date] => 05/08/2013 [datetime] => 05/08/2013 9:41:15 [department] => stuff [employee_ext] => 7457 [employee_email] => [barcode] => *nzs01* [doctor_df_code] => 09hq [doctor_npi] => 1111111111 [doctor_dea] => b4574 [doctor_upin] => [doctor_license] => [doctor_phone] => (111)111-1111 [doctor_fax] => (000)000-0000 [doctor_fname] => undefined [doctor_lname] => undefined [doctor_title] => [doctor_intake_rx_caller_id] => [doctor_c

opengl - making lighting inside a cube and reflecting the texture -

i'm trying make light shine inside cube , reflect image on bottom of cube,i have been trying make work seems keep failing supposed do,may 1 explain me,what should add code below,normally code reflecting sides of cube on floor created.... this cube code below void drawcube(int textureid, float angle) { gldisable(gl_texture_2d); glpushmatrix(); glrotatef( rotate_x, 1.0, 0.0, 0.0 ); glrotatef( rotate_y, 0.0, 1.0, 0.0 ); glbegin(gl_quads); //bottom face glcolor3f(1.0f, 0.0f, 1.0f); glnormal3f(0.0, -1.0f, 0.0f); glvertex3f(-box_size / 2, -box_size / 2, -box_size / 2); glvertex3f(box_size / 2, -box_size / 2, -box_size / 2); glvertex3f(box_size / 2, -box_size / 2, box_size / 2); glvertex3f(-box_size / 2, -box_size / 2, box_size / 2); glend(); glenable(gl_texture_2d); glbindtexture(gl_texture_2d, textureid); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear); gltexparameteri(gl_texture_2d, gl_tex

Debugging Error in VBA Code -

i have following code adds zeroes number until number total of 7 digits long. worked fine until now, code is: sub addzeroes() 'declarations dim integer, j integer, endrow long 'converts column format text format application.screenupdating = false columns("a:a").select selection.numberformat = "@" 'finds bottom row endrow = activesheet.range("a1").end(xldown).row 'selects top cell in column activesheet.range("a1").select 'loop move cell cell = 1 endrow - 1 'moves cell down 1. assumes there's header row starts @ row 2 activecell.offset(1, 0).select 'the do-while loop keeps adding zeroes front of cell value until hits length of 7 while len(activecell.value) < 7 activecell.value = "0" & activecell.value loop next application.screenupdating = true end sub the code loops through column , if number not have 7 tota

join - How To Use Magento Collections to Run Query, Get Results, and Print Them -

i new programming, php, magento, , of all, sql. please forgive me if somehow dumb question. i trying use magento collections select 2 different columns in 2 different tables , join them. these 2 columns contain product numbers follow same conventions , goal , display product numbers field (lets call 'product_id') contains field b ('item_nr') does not . here function far, located in model called controller action. public function importcompare() { $orderlistcollect = mage::getmodel('personal_orderlist/orderlist')->getcollection() ->addfieldtoselect('product_id') ->addfieldtofilter('b.item_nr', null) ->getselect() ->joinleft( array('b'=>$this->gettable('catalog/product')), 'main_table.product_id = b.item_nr', array('b.item_nr')); echo $orderlistcollect; } by echoing variable, following query. select `main_table`.`product_id`, `b`.`erp_ite

visual studio 2008 - MFC CTabCtrl how to add a close button for a tab -

i'm using ctabctrl in mfc dialog based application. problem i'm having i'm adding tabs in runtime , can't add close button tabs close. how can achieve this? can't achieve using ctabctrl?. there other way done??.. thanks. if use cmfctabctrl instead, call cmfctabctrl::enableactivetabclosebutton method, add close button active tab.

dll - Powershell Call Assembly Delegate -

i have dll assembly our process control application, use load inside powershell script. the dll contains delegate type need use, delegate name : "x.y.delegate" i have method in dll should called way : method( delegatetype callbackmethod) so, need : define delegate in script of type "x.y.delegate" example $mydelegate define callback method gets invoked when process event triggered" note: i'm sorry if question seems silly, i'm absolute beginner. update: after reading comment , reading question more closely, think might looking utilize asynchronous event handling. below example listens events until timeout reached , exits. example assumes can change assembly add event. a class generates events: namespace classlibrary1 { public class class1 { public event eventhandler someevent; protected void onsomeevent(eventargs e) { var someevent = someevent; if (someevent != null) { someevent(this, e); }