Search Results

Search found 132 results on 6 pages for 'ent'.

Page 2/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • What are good technical questions to ask to determine the analytical skill of a programmer?

    - by ENT
    I am a non-technical recruiter and I want to lay out some initial interview questions, one of which is to determine the analytic skill of a person. We will soon launch our hiring process for programmers and we are mapping out what would be the best questions. I have read quite a few posts here that suggested on how to interview programmers but I haven't come across on what technical question to ask that non-technical recruiters can easily comprehend if the answer is good or bad.

    Read the article

  • Problem with Variable Scoping in Rebol's Object

    - by Rebol Tutorial
    I have modified the rebodex app so that it can be called from rebol's console any time by typing rebodex. To show the title of the app, I need to store it in app-title: system/script/header/title so tha it could be used later in view/new/title dex reform [self/app-title version] That works but as you can see I have named the var name "app-title", but if I use "title" instead, the window caption would show weird stuff (vid code). Why ? REBOL [ Title: "Rebodex" Date: 23-May-2010 Version: 2.1.1 File: %rebodex.r Author: "Carl Sassenrath" Modification: "Rebtut" Purpose: "A simple but useful address book contact database." Email: %carl--rebol--com library: [ level: 'intermediate platform: none type: 'tool domain: [file-handling DB GUI] tested-under: none support: none license: none see-also: none ] ] rebodex.context: context [ app-title: system/script/header/title version: system/script/header/version set 'rebodex func[][ names-path: %names.r ;data file name-list: none fields: [name company title work cell home car fax web email smail notes updat] names: either exists? names-path [load names-path][ [[name "Carl Sassenrath" title "Founder" company "REBOL Technologies" email "%carl--rebol--com" web "http://www.rebol.com"]] ] brws: [ if not empty? web/text [ if not find web/text "http://" [insert web/text "http://"] error? try [browse web/text] ] ] dial: [request [rejoin ["Dial number for " name/text "? (Not implemented.)"] "Dial" "Cancel"]] dex-styles: stylize [ lab: label 60x20 right bold middle font-size 11 btn: button 64x20 font-size 11 edge [size: 1x1] fld: field 200x20 font-size 11 middle edge [size: 1x1] inf: info font-size 11 middle edge [size: 1x1] ari: field wrap font-size 11 edge [size: 1x1] with [flags: [field tabbed]] ] dex-pane1: layout/offset [ origin 0 space 2x0 across styles dex-styles lab "Name" name: fld bold return lab "Title" title: fld return lab "Company" company: fld return lab "Email" email: fld return lab "Web" brws web: fld return lab "Address" smail: ari 200x72 return lab "Updated" updat: inf 200x20 return ] 0x0 updat/flags: none dex-pane2: layout/offset [ origin 0 space 2x0 across styles dex-styles lab "Work #" dial work: fld 140 return lab "Home #" dial home: fld 140 return lab "Cell #" dial cell: fld 140 return lab "Alt #" dial car: fld 140 return lab "Fax #" fax: fld 140 return lab "Notes" notes: ari 140x72 return pad 136x1 btn "Close" #"^q" [store-entry save-file unview] ] 0x0 dex: layout [ origin 8x8 space 0x1 styles dex-styles srch: fld 196x20 bold across rslt: list 180x150 [ nt: txt 178x15 middle font-size 11 [ store-entry curr: cnt find-name nt/text update-entry unfocus show dex ] ] supply [ cnt: count + scroll-off face/text: "" face/color: snow if not n: pick name-list cnt [exit] face/text: select n 'name face/font/color: black if curr = cnt [face/color: system/view/vid/vid-colors/field-select] ] sl: slider 16x150 [scroll-list] return return btn "New" #"^n" [new-name] btn "Del" #"^d" [delete-name unfocus update-entry search-all show dex] btn "Sort" [sort names sort name-list show rslt] return at srch/offset + (srch/size * 1x0) bx1: box dex-pane1/size bx2: box dex-pane2/size return ] bx1/pane: dex-pane1/pane bx2/pane: dex-pane2/pane rslt/data: [] this-name: first names name-list: copy names curr: none search-text: "" scroll-off: 0 srch/feel: make srch/feel [ redraw: func [face act pos][ face/color: pick face/colors face system/view/focal-face if all [face = system/view/focal-face face/text search-text] [ search-text: copy face/text search-all if 1 = length? name-list [this-name: first name-list update-entry show dex] ] ] ] update-file: func [data] [ set [path file] split-path names-path if not exists? path [make-dir/deep path] write names-path data ] save-file: has [buf] [ buf: reform [{REBOL [Title: "Name Database" Date:} now "]^/[^/"] foreach n names [repend buf [mold n newline]] update-file append buf "]" ] delete-name: does [ remove find/only names this-name if empty? names [append-empty] save-file new-name ] clean-names: function [][n][ forall names [ if any [empty? first names none? n: select first names 'name empty? n][ remove names ] ] names: head names ] search-all: function [] [ent flds] [ clean-names clear name-list flds: [name] either empty? search-text [insert name-list names][ foreach nam names [ foreach word flds [ if all [ent: select nam word find ent search-text][ append/only name-list nam break ] ] ] ] scroll-off: 0 sl/data: 0 resize-drag scroll-list curr: none show [rslt sl] ] new-name: does [ store-entry clear-entry search-all append-empty focus name ; update-entry ] append-empty: does [append/only names this-name: copy []] find-name: function [str][] [ foreach nam names [ if str = select nam 'name [ this-name: nam break ] ] ] store-entry: has [val ent flag] [ flag: 0 if not empty? trim name/text [ foreach word fields [ val: trim get in get word 'text either ent: select this-name word [ if ent val [insert clear ent val flag: flag + 1] ][ if not empty? val [repend this-name [word copy val] flag: flag + 1] ] if flag = 1 [flag: 2 updat/text: form now] ] if not zero? flag [save-file] ] ] update-entry: does [ foreach word fields [ insert clear get in get word 'text any [select this-name word ""] ] show rslt ] clear-entry: does [ clear-fields bx1 clear-fields bx2 updat/text: form now unfocus show dex ] show-names: does [ clear rslt/data foreach n name-list [ if n/name [append rslt/data n/name] ] show rslt ] scroll-list: does [ scroll-off: max 0 to-integer 1 + (length? name-list) - (100 / 16) * sl/data show rslt ] do resize-drag: does [sl/redrag 100 / max 1 (16 * length? name-list)] center-face dex new-name focus srch show-names view/new/title dex reform [app-title version] insert-event-func [ either all [event/type = 'close event/face = dex][ store-entry unview ][event] ] do-events ] ]

    Read the article

  • Slick2D - Entities and rendering

    - by Zarkopafilis
    I have been trying to create my very first game for quite a while, followed some tutorials and stuff, but I am stuck at creating my entity system. I have made a class that extends the Entity class and here it is: public class Lazer extends Entity{//Just say that it is some sort of bullet private Play p;//Play class(State) private float x; private float y; private int direction; public Lazer(Play p, float x , float y, int direction){ this.p = p; this.x = x; this.y = y; this.direction = direction; p.ent.add(this); } public int getDirection(){ return direction; //this one specifies what value will be increased (x/y) at update } public float getX(){ return x; } public float getY(){ return y; } public void setY(float y){ this.y = y; } public void setX(float x){ this.x = x; } } The class seems pretty good , after speding some hours googling what would be the right thing. Now, on my Play class. I cant figure out how to draw them. (I have added them to an arraylist) On the update method , I update the lazers based on their direction: public void moveLazers(int delta){ for(int i=0;i<ent.size();i++){ Lazer l = ent.get(i); if(l.getDirection() == 1){ l.setX(l.getX() + delta * .1f); }else if(l.getDirection() == 2){ l.setX(l.getX() - delta * .1f); }else if(l.getDirection() == 3){ l.setY(l.getY() + delta * .1f); }else if(l.getDirection() == 4){ l.setY(l.getY() - delta * .1f); } } } Now , I am stuck at the render method. Anyway , is this the correct way of doing this or do I need to change stuff? Also I need to know if collision detection needs to be in the update method. Thanks in advance ~ Teo Ntakouris

    Read the article

  • How to avoid game objects accidentally deleting themselves in C++

    - by Tom Dalling
    Let's say my game has a monster that can kamikaze explode on the player. Let's pick a name for this monster at random: a Creeper. So, the Creeper class has a method that looks something like this: void Creeper::kamikaze() { EventSystem::postEvent(ENTITY_DEATH, this); Explosion* e = new Explosion; e->setLocation(this->location()); this->world->addEntity(e); } The events are not queued, they get dispatched immediately. This causes the Creeper object to get deleted somewhere inside the call to postEvent. Something like this: void World::handleEvent(int type, void* context) { if(type == ENTITY_DEATH){ Entity* ent = dynamic_cast<Entity*>(context); removeEntity(ent); delete ent; } } Because the Creeper object gets deleted while the kamikaze method is still running, it will crash when it tries to access this->location(). One solution is to queue the events into a buffer and dispatch them later. Is that the common solution in C++ games? It feels like a bit of a hack, but that might just be because of my experience with other languages with different memory management practices. In C++, is there a better general solution to this problem where an object accidentally deletes itself from inside one of its methods?

    Read the article

  • C++ program...overshoots? [migrated]

    - by Zdrok
    I'm decent at C++, but I may have missed some nuance that applies here. Or maybe I completely missed a giant concept, I have no idea. My program was instantly crashing ("blah.exe is not responding") about 1/5 times it was run (other times it ran completely fine) and I tracked the problem down to a constructor for a world class that was called once in the beginning of the main function. Here is the code (in the constructor) that causes the problem: int ii; for(ii=0;ii<=255;ii++) { cout<<"ent "<<ii<<endl; entity_list[ii]=NULL; } for(ii=0;ii<=255;ii++) { cout<<"sec "<<ii<<endl; sector_list[ii]=NULL; } entity_list[0] = new Entity(0,0); entity_list[0]->_world = this; Specifically the second for loop. The cout references are new for the sake of telling where it is having trouble. It would print the entire "ent 1" to "ent 255" and then "sec 1" to "sec 255" and then crash right after, as if it was going for a 257th run through of the second for loop. I set the second for loop to go until "ii<=254" which stopped all crashes. Does C++ code tend to "overshoot" for loops or something? What is causing it to crash at this specific loop seemingly at random? By the way, entity_list and sector_list point to classes called Entity and Sector, respectively, but they are not constructing anything so I didn't think it would be relevant. I also have a forward declaration for the Entity class in a header for this, but since none were being constructed I didn't think it was relevant either. EDIT: It was due to the new Entity line, I assumed wrongly that the fact that altering the for statement to 254 fixed the crashes meant that it had to be there. I still don't understand why the for loop is related, though.

    Read the article

  • How to remove .zip file in c on windows? (error: Directory not empty)

    - by ExtremeBlue
    include include include include "win32-dirent.h" include include include define MAXFILEPATH 1024 bool IsDirectory(char* path) { WIN32_FIND_DATA w32fd; HANDLE hFindFile; hFindFile = FindFirstFile((PTCHAR)path, &w32fd); if(hFindFile == INVALID_HANDLE_VALUE) { return false; } return w32fd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY); } int RD(const char* folderName) { DIR *dir; struct dirent *ent; dir = opendir(folderName); if(dir != NULL) { while((ent = readdir(dir)) != NULL) { if(strcmp(ent->d_name , ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } char fileName[MAXFILEPATH]; sprintf(fileName,"%s%c%s", folderName, '\\', ent->d_name); if(IsDirectory(fileName)) { RD(fileName); } else { unlink(fileName); } } closedir(dir); //chmod(folderName, S_IWRITE | S_IREAD); if(_rmdir(folderName) != 0)perror(folderName); } else { printf("%s <%s>\n","Could Not Open Directory.", folderName); return -1; } return 0; } int main(int argc, char* argv[]) { if(argc < 2) { printf("usage: ./a.out \n"); return 1; } //RD(argv[1]); //_mkdir("12"); //_mkdir("12\\34"); //_rmdir("12\\34"); //_rmdir("12"); char buf[0xff]; sprintf(buf, "unzip -x -q -d 1234 1234.zip"); system(buf); RD("1234"); //unlink("D:\\dev\\c\\project\\removeFolder\\Debug\\1234\\56\\5.txt"); //unlink("D:\\dev\\c\\project\\removeFolder\\Debug\\1234\\56\\6.txt"); //unlink("D:\\dev\\c\\project\\removeFolder\\Debug\\1234\\1_23.zip"); //unlink("D:\\dev\\c\\project\\removeFolder\\Debug\\1234\\4.txt"); //_rmdir("D:\\dev\\c\\project\\removeFolder\\Debug\\1234\\56"); //_rmdir("D:\\dev\\c\\project\\removeFolder\\Debug\\1234"); return 0; } Archive: 1234.zip inflating: 1234/4.txt inflating: 1234/56/5.txt inflating: 1234/56/6.txt inflating: 1234/1_23.zip

    Read the article

  • I am trying to figure out the best way to understand how to cache domain objects

    - by Brett Ryan
    I've always done this wrong, I'm sure a lot of others have too, hold a reference via a map and write through to DB etc.. I need to do this right, and I just don't know how to go about it. I know how I want my objects to be cached but not sure on how to achieve it. What complicates things is that I need to do this for a legacy system where the DB can change without notice to my application. So in the context of a web application, let's say I have a WidgetService which has several methods: Widget getWidget(); Collection<Widget> getAllWidgets(); Collection<Widget> getWidgetsByCategory(String categoryCode); Collection<Widget> getWidgetsByContainer(Integer parentContainer); Collection<Widget> getWidgetsByStatus(String status); Given this, I could decide to cache by method signature, i.e. getWidgetsByCategory("AA") would have a single cache entry, or I could cache widgets individually, which would be difficult I believe; OR, a call to any method would then first cache ALL widgets with a call to getAllWidgets() but getAllWidgets() would produce caches that match all the keys for the other method invocations. For example, take the following untested theoretical code. Collection<Widget> getAllWidgets() { Entity entity = cache.get("ALL_WIDGETS"); Collection<Widget> res; if (entity == null) { res = loadCache(); } else { res = (Collection<Widget>) entity.getValue(); } return res } Collection<Widget> loadCache() { // Get widgets from underlying DB Collection<Widget> res = db.getAllWidgets(); cache.put("ALL_WIDGETS", res); Map<String, List<Widget>> byCat = new HashMap<>(); for (Widget w : res) { // cache by different types of method calls, i.e. by category if (!byCat.containsKey(widget.getCategory()) { byCat.put(widget.getCategory(), new ArrayList<Widget>); } byCat.get(widget.getCatgory(), widget); } cacheCategories(byCat); return res; } Collection<Widget> getWidgetsByCategory(String categoryCode) { CategoryCacheKey key = new CategoryCacheKey(categoryCode); Entity ent = cache.get(key); if (entity == null) { loadCache(); } ent = cache.get(key); return ent == null ? Collections.emptyList() : (Collection<Widget>)ent.getValue(); } NOTE: I have not worked with a cache manager, the above code illustrates cache as some object that may hold caches by key/value pairs, though it's not modelled on any specific implementation. Using this I have the benefit of being able to cache all objects in the different ways they will be called with only single objects on the heap, whereas if I were to cache the method call invocation via say Spring It would (I believe) cache multiple copies of the objects. I really wish to try and understand the best ways to cache domain objects before I go down the wrong path and make it harder for myself later. I have read the documentation on the Ehcache website and found various articles of interest, but nothing to give a good solid technique. Since I'm working with an ERP system, some DB calls are very complicated, not that the DB is slow, but the business representation of the domain objects makes it very clumsy, coupled with the fact that there are actually 11 different DB's where information can be contained that this application is consolidating in a single view, this makes caching quite important.

    Read the article

  • python gui generate math equation

    - by Nero Dietrich
    I have a homework question for one specific item with python GUIs. My goal is to create a GUI that asks a random mathematical equation and if the equation is evaluated correctly, then I will receive a message stating that it is correct. My main problem is finding out where to place my statements so that they show up in the labels; I have 1 textbox which generates the random equation, the next textbox is blank for me to enter the solution, and then an "Enter" button at the end to evaluate my solution. It looks like this: [randomly generated equation][Empty space to enter solution] [ENTER] I've managed to get the layout and the evaluate parameters, but I don't know where to go from here. This is my code so far: class Equation(Frame): def __init__(self,parent=None): Frame.__init__(self, parent) self.pack() Equation.make_widgets(self) Equation.new_problem(self) def make_widgets(self): Label(self).grid(row=0, column=1) ent = Entry(self) ent.grid(row=0, column=1) Label(self).grid(row=0, column=2) ent = Entry(self) ent.grid(row=0, column=2) Button(self, text='Enter', command=self.evaluate).grid(row=0, column=3) def new_problem(self): pass def evaluate(self): result = eval(self.get()) self.delete(0, END) self.insert(END, result) print('Correct')

    Read the article

  • Process XML in C# using external entity file

    - by Ryan Berger
    I am processing an XML file (which does not contain any dtd or ent declarations) in C# that contains entities such as &eacute; and &agrave;. I receive the following exception when attempting to load an XML file... XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(record); Reference to undeclared entity 'eacute'. I was able to track down the proper ent file here. How do I tell XmlDocument to use this ent file when loading my XML file?

    Read the article

  • Can't get results from a IQueryable.

    - by StackPointer
    Hi! I have the following code in Linq to Entity: var policy= from pol in conn.Policy where pol.Product.DESCRIPTION=="someProduct" SELECT pol; Then, the table Policy, has some dependencies for a table called Entity. If I do this: foreach(Policy p in policy){ if(!p.Entity.IsLoaded) p.Entity.Load(); IEnumerable<Entity> entities= from ent in p.Entity Where ent.EntityType.DESCRIPTION=="SomeEntityType" select ent; Console.Writeline(entities.ElementAt(0).NAME); } It says, "Object not set to an instance", but if I do: foreach(Policy p in policy){ if(!p.Entity.IsLoaded) p.Entity.Load(); foreach(Entity et in p.Entity)Console.Write(et.NAME); } It works! Can anyone tell me why? Thank you, Best regards.

    Read the article

  • LINQ to Entites: How should I handle System.InvalidOperationException when checking for existance of

    - by chris
    I have a many-to-one relationship that users can edit via checkboxes. PK of Foo is ID, and fid contains the id from the checkbox. I'm checking to see if an element exists with: Foo ent; try { ent = ctx.Foo.First(f => f.ID == fid); } catch (System.InvalidOperationException ioe) { ent = new Foo(); } It seems to me that I should be able to do this without throwing an exception. What would be the best way to do this?

    Read the article

  • How do I delete an object from an Entity Framework model without first loading it?

    - by Tomas Lycken
    I am quite sure I've seen the answer to this question somewhere, but as I couldn't find it with a couple of searches on SO or google, I ask it again anyway... In Entity Framework, the only way to delete a data object seems to be MyEntityModel ent = new MyEntityModel(); ent.DeleteObject(theObjectToDelete); ent.SaveChanges(); However, this approach requires the object to be loaded to, in this case, the Controller first, just to delete it. Is there a way to delete a business object referencing only for instance its ID? If there is a smarter way using Linq or Lambda expressions, that is fine too. The main objective, though, is to avoid loading data just to delete it.

    Read the article

  • VLC doesnot play any file [ any video/.mp3] in local machine , closes when a file is opened

    - by hsemarap
    When I run vlc from terminal I get: In the VLC dialog box: Your input can't be opened: VLC is unable to open the MRL 'file:///media/Ent/movies/the%20mask.avi'. Check the log for details. In terminal: VLC media player 2.0.1 Twoflower (revision 2.0.1-0-gf432547) [0x8fe8f8] main input error: open of `file/xspf-open:///home/para/.local/share/vlc/ml.xspf' failed [0x8fe8f8] main input error: Your input can't be opened [0x8fe8f8] main input error: VLC is unable to open the MRL 'file/xspf-open:///home/para/.local/share/vlc/ml.xspf'. Check the log for details. [0x8f1aa8] main interface error: no suitable interface module [0x8f9b08] main interface error: no suitable interface module [0x8be008] main libvlc error: option http-user-agent does not exist [0x8be008] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. [0x8f9b08] qt4 interface error: Unable to load extensions module [0x7f5280000b78] main input error: open of `file:///media/Ent/movies/the%20mask.avi' failed [0x8fc718] main playlist error: could not export playlist

    Read the article

  • Struct Method for Loops Problem

    - by Annalyne
    I have tried numerous times how to make a do-while loop using the float constructor for my code but it seems it does not work properly as I wanted. For summary, I am making a TBRPG in C++ and I encountered few problems. But before that, let me post my code. #include <iostream> #include <string> #include <ctime> #include <cstdlib> using namespace std; int char_level = 1; //the starting level of the character. string town; //town string town_name; //the name of the town the character is in. string charname; //holds the character's name upon the start of the game int gems = 0; //holds the value of the games the character has. const int MAX_ITEMS = 15; //max items the character can carry string inventory [MAX_ITEMS]; //the inventory of the character in game int itemnum = 0; //number of items that the character has. bool GameOver = false; //boolean intended for the game over scr. string monsterTroop [] = {"Slime", "Zombie", "Imp", "Sahaguin, Hounds, Vampire"}; //monster name float monsterTroopHealth [] = {5.0f, 10.0f, 15.0f, 20.0f, 25.0f}; // the health of the monsters int monLifeBox; //life carrier of the game's enemy troops int enemNumber; //enemy number //inventory[itemnum++] = "Sword"; class RPG_Game_Enemy { public: void enemyAppear () { srand(time(0)); enemNumber = 1+(rand()%3); if (enemNumber == 1) cout << monsterTroop[1]; //monster troop 1 else if (enemNumber == 2) cout << monsterTroop[2]; //monster troop 2 else if (enemNumber == 3) cout << monsterTroop[3]; //monster troop 3 else if (enemNumber == 4) cout << monsterTroop[4]; //monster troop 4 } void enemDefeat () { cout << "The foe has been defeated. You are victorious." << endl; } void enemyDies() { //if the enemy dies: //collapse declaration cout << "The foe vanished and you are victorious!" << endl; } }; class RPG_Scene_Battle { public: RPG_Scene_Battle(float ini_health) : health (ini_health){}; float getHealth() { return health; } void setHealth(float rpg_val){ health = rpg_val;}; private: float health; }; //---------------------------------------------------------------// // Conduct Damage for the Scene Battle's Damage //---------------------------------------------------------------// float conductDamage(RPG_Scene_Battle rpg_tr, float damage) { rpg_tr.setHealth(rpg_tr.getHealth() - damage); return rpg_tr.getHealth(); }; // ------------------------------------------------------------- // void RPG_Scene_DisplayItem () { cout << "Items: \n"; for (int i=0; i < itemnum; ++i) cout << inventory[i] <<endl; }; In this code I have so far, the problem I have is the battle scene. For example, the player battles a Ghost with 10 HP, when I use a do while loop to subtract the HP of the character and the enemy, it only deducts once in the do while. Some people said I should use a struct, but I have no idea how to make it. Is there a way someone can display a code how to implement it on my game? Edit: I made the do-while by far like this: do RPG_Scene_Battle (player, 20.0f); RPG_Scene_Battle (enemy, 10.0f); cout << "Battle starts!" <<endl; cout << "You used a blade skill and deducted 2 hit points to the enemy!" conductDamage (enemy, 2.0f); while (enemy!=0) also, I made something like this: #include <iostream> using namespace std; int gems = 0; class Entity { public: Entity(float startingHealth) : health(startingHealth){}; // initialize health float getHealth(){return health;} void setHealth(float value){ health = value;}; private: float health; }; float subtractHealthFrom(Entity& ent, float damage) { ent.setHealth(ent.getHealth() - damage); return ent.getHealth(); }; int main () { Entity character(10.0f); Entity enemy(10.0f); cout << "Hero Life: "; cout << subtractHealthFrom(character, 2.0f) <<endl; cout << "Monster Life: "; cout << subtractHealthFrom(enemy, 2.0f) <<endl; cout << "Hero Life: "; cout << subtractHealthFrom(character, 2.0f) <<endl; cout << "Monster Life: "; cout << subtractHealthFrom(enemy, 2.0f) <<endl; }; Struct method, they say, should solve this problem. How can I continously deduct hp from the enemy? Whenever I deduct something, it would return to its original value -_-

    Read the article

  • Extracting the Date from a DateTime in Entity Framework 4 and LINQ

    - by Ken Cox [MVP]
    In my current ASP.NET 4 project, I’m displaying dates in a GridDateTimeColumn of Telerik’s ASP.NET Radgrid control. I don’t care about the time stuff, so my DataFormatString shows only the date bits: <telerik:GridDateTimeColumn FilterControlWidth="100px"   DataField="DateCreated" HeaderText="Created"    SortExpression="DateCreated" ReadOnly="True"    UniqueName="DateCreated" PickerType="DatePicker"    DataFormatString="{0:dd MMM yy}"> My problem was that I couldn’t get the built-in column filtering (it uses Telerik’s DatePicker control) to behave.  The DatePicker assumes that the time is 00:00:00 but the data would have times like 09:22:21. So, when you select a date and apply the EqualTo filter, you get no results. You would get results if all the time portions were 00:00:00. In essence, I wanted my Entity Framework query to give the DatePicker what it wanted… a Date without the Time portion. Fortunately, EF4 provides the TruncateTime  function. After you include Imports System.Data.Objects.EntityFunctions You’ll find that your EF queries will accept the TruncateTime function. Here’s my routine: Protected Sub RadGrid1_NeedDataSource _     (ByVal source As Object, _      ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) _     Handles RadGrid1.NeedDataSource     Dim ent As New OfficeBookDBEntities1     Dim TopBOMs = From t In ent.TopBom, i In ent.Items _                   Where t.BusActivityID = busActivityID _       And i.BusActivityID And t.ItemID = i.RecordID _       Order By t.DateUpdated Descending _       Select New With {.TopBomID = t.TopBomID, .ItemID = t.ItemID, _                        .PartNumber = i.PartNumber, _                        .Description = i.Description, .Notes = t.Notes, _                        .DateCreated = TruncateTime(t.DateCreated), _                        .DateUpdated = TruncateTime(t.DateUpdated)}     RadGrid1.DataSource = TopBOMs End Sub Now when I select March 14, 2011 on the DatePicker, the filter doesn’t stumble on time values that don’t make sense. Full Disclosure: Telerik gives me (and other developer MVPs) free copies of their suite.

    Read the article

  • Matching Regular Expression in Javascript and PHP problem...

    - by Frankie
    I can't figure out how to get the same result from my Javscript as I do from my PHP. In particular, Javascript always leaves out the backslashes. Please ignore the random forward and backslashes; I put them there so that I can cover my basis on a windows system or any other system. Output: Input String: "/root\wp-cont ent\@*%'i@$@%$&^(@#@''mage6.jpg:" /root\wp-content\image6.jpg (PHP Output) /rootwp-contentimage6.jpg (Javscript Output) I would appreciate any help! PHP: <?php $path ="/root\wp-cont ent\@*%'i@$@%$&^(@#@''mage6.jpg:"; $path = preg_replace("/[^a-zA-Z0-9\\\\\/\.-]/", "", $path); echo $path; ?> Javascript: <script type="text/javascript"> var path = "/root\wp-cont ent\@*%'i@$@%$&^(@#@''mage6.jpg:"; //exact same string as PHP var regx = /[^a-zA-Z0-9\.\/-]/g; path = path.replace(regx,""); document.write("<br>"+path); </script>

    Read the article

  • Accessing derived class members with a base class pointer

    - by LRB
    I am making a simple console game in C++ I would like to know if I can access members from the 'entPlayer' class while using a pointer that is pointing to the base class ( 'Entity' ): class Entity { public: void setId(int id) { Id = id; } int getId() { return Id; } protected: int Id; }; class entPlayer : public Entity { string Name; public: entPlayer() { Name = ""; Id = 0; } void setName(string name) { Name = name; } string getName() { return Name; } }; Entity *createEntity(string Type) { Entity *Ent = NULL; if (Type == "player") { Ent = new entPlayer; } return Ent; } void main() { Entity *ply = createEntity("player"); ply->setName("Test"); ply->setId(1); cout << ply->getName() << endl; cout << ply->getId() << endl; delete ply; } How would I be able to call ply-setName etc? OR If it's not possible that way, what would be a better way?

    Read the article

  • SSIS parsing of an irregular flat file?

    - by ElHaix
    I'm pretty familiar with SSIS parsing of regular delimited text data files, however, I'm looking for some advice on an approach to tackle a file that looks like this test file: ISA*00* *00* *01*220220220 *ZZ*RL CODE 01*060327*1212*U*00300*000008859*0*P*:~ GS*RA*CPA-BPT*LOCALUTILITY*060319*1212*970819003*X*003030~ ST*820*000000001~ BPR*C*321.91*C*X12*CBC*04*000300488**9918939***04*000300002**1598564*070319~ TRN*1*00075319970819105029~ REF*RR*0003199708190000174858~ DTM*097*070318~ DTM*107*070318~ N1*PR*DIRECT PAYMENT~ N1*PE*ABC CORPORATE BILLER*ZZ*90005836~ ENT*1~ N1*PR*BILLING - TEST - NATTRASS~ RMR*CR*0009381082105011**142.15~ REF*TN*000303965~ DTM*109*070316~ ENT*2~ N1*PR*BILL FREID TEST~ RMR*CR*0011010451800011**179.76~ REF*TN*000304189~ The 321.91 is the total of the transaction. I would prefer to do this with SSIS, but could also do create a C# parser. Suggestions would be appreciated. Thank you.

    Read the article

  • Visual Modeler in VS 6

    - by Yogi Yang 007
    Till date I have used only VB6 Professional for developing apps. But recently I have joined a company which owns VS 6 Enterprise (or some such version) I was just exploring what is available in VS 6 Ent. and I found Visual Modeler. The tutorial provided with it is not good enough. I was wondering if there is any detailed tutorial(s) for Visual Modeler? Is Visual Modeler a cut down version of Rational Rose? I have never used such a tool for developing apps. What are the benefits of developing apps like this? The document claims that one can speed up development and modifications of VB6 & VC++ 6 applications. How true is this claim? My company also has Ration Rose 6. Which is better Rational Rose 6 or Visual Modeler that comes with VS 6 Ent.?

    Read the article

  • KRL and Yahoo Local Search

    - by Randall Bohn
    I'm trying to use Yahoo Local Search in a Kynetx Application. ruleset avogadro { meta { name "yahoo-local-ruleset" description "use results from Yahoo local search" author "randall bohn" key yahoo_local "get-your-own-key" } dispatch { domain "example.com"} global { datasource local:XML <- "http://local.yahooapis.com/LocalSearchService/V3/localsearch"; } rule add_list { select when pageview ".*" setting () pre { ds = datasource:local("?appid=#{keys:yahoo_local()}&query=pizza&zip=#{zip}&results=5"); rs = ds.pick("$..Result"); } append("body","<ul id='my_list'></ul>"); always { set ent:pizza rs; } } rule add_results { select when pageview ".*" setting () foreach ent:pizza setting pizza pre { title = pizza.pick("$..Title"); } append("#my_list", "<li>#{title}</li>"); } } The list I wind up with is . [object Object] and 'title' has {'$t' => 'Pizza Shop 1'} I can't figure out how to get just the title.

    Read the article

  • asp.net mvc custom model binding in an update entity scenario

    - by mctayl
    Hi I have a question about model binding. Imagine you have an existing database entity displayed in a form and you'd like to edit some details, some properties eg createddate etc are not bound to the form, during model binding, these properties are not assigned to the model as they are not on the http post data or querystrong etc, hence their properties are null. In my controller method for update , Id just like to do public ActionResult Update( Entity ent) { //Save changes to db } but as some properties are null in ent, they override the existing database fields which are not part of the form post data, What is the correct way to handle this? Ive tried hidden fields to hold the data, but model binding does not seem to assign hidden fields to the model. Any suggestions would be appreciated

    Read the article

  • Enterprise library not responding.

    - by Costa
    Hi I spent a day trying to make Ent Lib Logging work and log anything into database or event log, I have a web application and console application withe the same Ent Lib config, only the console is capable to log into the Event Log, I tried everything with permissions, but I don't know what exactly I am doing, which services should have what, It does not work!! HELP This is the config file which is automatically generated from Ent Lib utility and it works only on App.config, not on web.config <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true" revertImpersonation="false"> <listeners> <add source="Logger" formatter="Text Formatter" log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Formatted EventLog TraceListener" /> </listeners> <formatters> <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Text Formatter" /> </formatters> <categorySources> <add switchValue="All" name="General"> <listeners> <add name="Formatted EventLog TraceListener" /> </listeners> </add> </categorySources> <specialSources> <allEvents switchValue="All" name="All Events" /> <notProcessed switchValue="All" name="Unprocessed Category" /> <errors switchValue="All" name="Logging Errors &amp; Warnings"> <listeners> <add name="Formatted EventLog TraceListener" /> </listeners> </errors> </specialSources> </loggingConfiguration> thanks

    Read the article

  • tkinter python entry not being displayed

    - by user1050619
    I have created a Form with labels and entries..but for some reason the entries are not being created, peoplegui.py from tkinter import * from tkinter.messagebox import showerror import shelve shelvename = 'class-shelve' fieldnames = ('name','age','job','pay') def makewidgets(): global entries window = Tk() window.title('People Shelve') form = Frame(window) form.pack() entries = {} for (ix, label) in enumerate(('key',) + fieldnames): lab = Label(form, text=label) ent = Entry(form) lab.grid(row=ix, column=0) lab.grid(row=ix, column=1) entries[label] = ent Button(window, text="Fetch", command=fetchRecord).pack(side=LEFT) Button(window, text="Update", command=updateRecord).pack(side=LEFT) Button(window, text="Quit", command=window.quit).pack(side=RIGHT) return window def fetchRecord(): print('In fetch') def updateRecord(): print('In update') if __name__ == '__main__': window = makewidgets() window.mainloop() When I run it the labels are created but not the entries.

    Read the article

  • Why am I getting an IndexOutOfBoundsException here?

    - by Berzerker
    I'm getting an index out of bounds exception thrown and I don't know why, within my replaceValue method below. [null, (10,4), (52,3), (39,9), (78,7), (63,8), (42,2), (50,411)] replacement value test:411 size=7 [null, (10,4), (52,3), (39,9), (78,7), (63,8), (42,2), (50,101)] removal test of :(10,4) [null, (39,9), (52,3), (42,2), (78,7), (63,8), (50,101)] size=6 I try to replace the value again here and get an error... package heappriorityqueue; import java.util.*; public class HeapPriorityQueue<K,V> { protected ArrayList<Entry<K,V>> heap; protected Comparator<K> comp; int size = 0; protected static class MyEntry<K,V> implements Entry<K,V> { protected K key; protected V value; protected int loc; public MyEntry(K k, V v,int i) {key = k; value = v;loc =i;} public K getKey() {return key;} public V getValue() {return value;} public int getLoc(){return loc;} public String toString() {return "(" + key + "," + value + ")";} void setKey(K k1) {key = k1;} void setValue(V v1) {value = v1;} public void setLoc(int i) {loc = i;} } public HeapPriorityQueue() { heap = new ArrayList<Entry<K,V>>(); heap.add(0,null); comp = new DefaultComparator<K>(); } public HeapPriorityQueue(Comparator<K> c) { heap = new ArrayList<Entry<K,V>>(); heap.add(0,null); comp = c; } public int size() {return size;} public boolean isEmpty() {return size == 0; } public Entry<K,V> min() throws EmptyPriorityQueueException { if (isEmpty()) throw new EmptyPriorityQueueException("Priority Queue is Empty"); return heap.get(1); } public Entry<K,V> insert(K k, V v) { size++; Entry<K,V> entry = new MyEntry<K,V>(k,v,size); heap.add(size,entry); upHeap(size); return entry; } public Entry<K,V> removeMin() throws EmptyPriorityQueueException { if (isEmpty()) throw new EmptyPriorityQueueException("Priority Queue is Empty"); if (size == 1) return heap.remove(1); Entry<K,V> min = heap.get(1); heap.set(1, heap.remove(size)); size--; downHeap(1); return min; } public V replaceValue(Entry<K,V> e, V v) throws InvalidEntryException, EmptyPriorityQueueException { // replace the value field of entry e in the priority // queue with the given value v, and return the old value This is where I am getting the IndexOutOfBounds exception, on heap.get(i); if (isEmpty()){ throw new EmptyPriorityQueueException("Priority Queue is Empty."); } checkEntry(e); int i = e.getLoc(); Entry<K,V> entry=heap.get(((i))); V oldVal = entry.getValue(); K key=entry.getKey(); Entry<K,V> insert = new MyEntry<K,V>(key,v,i); heap.set(i, insert); return oldVal; } public K replaceKey(Entry<K,V> e, K k) throws InvalidEntryException, EmptyPriorityQueueException, InvalidKeyException { // replace the key field of entry e in the priority // queue with the given key k, and return the old key if (isEmpty()){ throw new EmptyPriorityQueueException("Priority Queue is Empty."); } checkKey(k); checkEntry(e); K oldKey=e.getKey(); int i = e.getLoc(); Entry<K,V> entry = new MyEntry<K,V>(k,e.getValue(),i); heap.set(i,entry); downHeap(i); upHeap(i); return oldKey; } public Entry<K,V> remove(Entry<K,V> e) throws InvalidEntryException, EmptyPriorityQueueException{ // remove entry e from priority queue and return it if (isEmpty()){ throw new EmptyPriorityQueueException("Priority Queue is Empty."); } MyEntry<K,V> entry = checkEntry(e); if (size==1){ return heap.remove(size--); } int i = e.getLoc(); heap.set(i, heap.remove(size--)); downHeap(i); return entry; } protected void upHeap(int i) { while (i > 1) { if (comp.compare(heap.get(i/2).getKey(), heap.get(i).getKey()) <= 0) break; swap(i/2,i); i = i/2; } } protected void downHeap(int i) { int smallerChild; while (size >= 2*i) { smallerChild = 2*i; if ( size >= 2*i + 1) if (comp.compare(heap.get(2*i + 1).getKey(), heap.get(2*i).getKey()) < 0) smallerChild = 2*i+1; if (comp.compare(heap.get(i).getKey(), heap.get(smallerChild).getKey()) <= 0) break; swap(i, smallerChild); i = smallerChild; } } protected void swap(int j, int i) { heap.get(j).setLoc(i); heap.get(i).setLoc(j); Entry<K,V> temp; temp = heap.get(j); heap.set(j, heap.get(i)); heap.set(i, temp); } public String toString() { return heap.toString(); } protected MyEntry<K,V> checkEntry(Entry<K,V> ent) throws InvalidEntryException { if(ent == null || !(ent instanceof MyEntry)) throw new InvalidEntryException("Invalid entry."); return (MyEntry)ent; } protected void checkKey(K key) throws InvalidKeyException{ try{comp.compare(key,key);} catch(Exception e){throw new InvalidKeyException("Invalid key.");} } }

    Read the article

  • Lightweight use of Enterprise Library TraceListeners

    - by gWiz
    Is it possible to use the Enterprise Library 4.1 TraceListeners without using the entire Enterprise Library Logging AB? I'd prefer to simply use .NET Diagnostics Tracing, but would like to setup a listener that sends emails on Error events. I figured I could use the Enterprise Library EmailTraceListener. However, my initial attempts to configure it have failed. Here's what I hoped would work: <system.diagnostics> <trace autoflush="false" /> <sources> <source name="SampleSource" switchValue="Verbose" > <listeners> <add name="textFileListener" /> <add name="emailListener" /> </listeners> </source> </sources> <sharedListeners> <add name="textFileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="..\trace.log" traceOutputOptions="DateTime"> <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" /> </add> <add name="emailListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging" toAddress="[email protected]" fromAddress="[email protected]" smtpServer="mail.example.com" > <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" /> </add> </sharedListeners> </system.diagnostics> However I get [ArgumentException: The parameter 'address' cannot be an empty string. Parameter name: address] System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) +1098157 System.Net.Mail.MailAddress..ctor(String address) +8 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailMessage.CreateMailMessage() +256 Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailMessage.Send() +39 Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener.Write(String message) +96 System.Diagnostics.TraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id) +184 System.Diagnostics.TraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String format, Object[] args) +63 System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args) +198 System.Diagnostics.TraceSource.TraceInformation(String message) +14 Which leads me to believe the .NET Tracing code does not care about the "non-standard" config attributes I've supplied for emailListener. I also tried adding the appropriate LAB configSection declaration and: <loggingConfiguration> <listeners> <add toAddress="[email protected]" fromAddress="[email protected]" smtpServer="mail.example.com" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging" name="emailListener" /> </listeners> </loggingConfiguration> This also results in the same exception. I figure it's possible to programmatically configure the EmailTraceListener, but I prefer this to be config-driven. I also understand I can implement my own derivative of TraceListener. So, is it possible to use the Ent Lib TraceListeners, without using the whole Ent Lib LAB, and configure them from the config file? Update: After examining the code, I have discovered it is not possible. The Ent Lib TraceListeners do not actually utilize the config attributes they specify in overriding TraceListener.GetSupportedAttributes(), despite the recommendations in the .NET TraceListener documentation. Bug filed.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >