Daily Archives

Articles indexed Friday December 24 2010

Page 22/25 | < Previous Page | 18 19 20 21 22 23 24 25  | Next Page >

  • Is MVC now the only way to write PHP?

    - by JasonS
    Hey... its XMAS Eve and something is bugging me... yes, I have work on my mind even when I am on holiday. The vast amount of frameworks available for PHP now use MVC. Even ASP.net has its own MVC module. I can see the attraction of MVC, I really can and I use it frequently. The only downside that I can see is that you have to fire up the whole system to execute a page request. Depending on your task this can be a little wasteful. So the question. In a professional environment is this the only way to use PHP nowadays or are their other design methods which have alternative benefits?

    Read the article

  • BizTalk: History of one project architecture

    - by Leonid Ganeline
    "In the beginning God made heaven and earth. Then he started to integrate." At the very start was the requirement: integrate two working systems. Small digging up: It was one system. It was good but IT guys want to change it to the new one, much better, chipper, more flexible, and more progressive in technologies, more suitable for the future, for the faster world and hungry competitors. One thing. One small, little thing. We cannot turn off the old system (call it A, because it was the first), turn on the new one (call it B, because it is second but not the last one). The A has a hundreds users all across a country, they must study B. A still has a lot nice custom features, home-made features that cannot disappear. These features have to be moved to the B and it is a long process, months and months of redevelopment. So, the decision was simple. Let’s move not jump, let’s both systems working side-by-side several months. In this time we could teach the users and move all custom A’s special functionality to B. That automatically means both systems should work side-by-side all these months and use the same data. Data in A and B must be in sync. That’s how the integration projects get birth. Moreover, the specific of the user tasks requires the both systems must be in sync in real-time. Nightly synchronization is not working, absolutely.   First draft The first draft seems simple. Both systems keep data in SQL databases. When data changes, the Create, Update, Delete operations performed on the data, and the sync process could be started. The obvious decision is to use triggers on tables. When we are talking about data, we are talking about several entities. For example, Orders and Items [in Orders]. We decided to use the BizTalk Server to synchronize systems. Why it was chosen is another story. Second draft   Let’s take an example how it works in more details. 1.       User creates a new entity in the A system. This fires an insert trigger on the entity table. Trigger has to pass the message “Entity created”. This message includes all attributes of the new entity, but I focused on the Id of this entity in the A system. Notation for this message is id.A. System A sends id.A to the BizTalk Server. 2.       BizTalk transforms id.A to the format of the system B. This is easiest part and I will not focus on this kind of transformations in the following text. The message on the picture is still id.A but it is in slightly different format, that’s why it is changing in color. BizTalk sends id.A to the system B. 3.       The system B creates the entity on its side. But it uses different id-s for entities, these id-s are id.B. System B saves id.A+id.B. System B sends the message id.A+id.B back to the BizTalk. 4.       BizTalk sends the message id.A+id.B to the system A. 5.       System A saves id.A+id.B. Why both id-s should be saved on both systems? It was one of the next requirements. Users of both systems have to know the systems are in sync or not in sync. Users working with the entity on the system A can see the id.B and use it to switch to the system B and work there with the copy of the same entity. The decision was to store the pairs of entity id-s on both sides. If there is only one id, the entities are not in sync yet (for the Create operation). Third draft Next problem was the reliability of the synchronization. The synchronizing process can be interrupted on each step, when message goes through the wires. It can be communication problem, timeout, temporary shutdown one of the systems, the second system cannot be synchronized by some internal reason. There were several potential problems that prevented from enclosing the whole synchronization process in one transaction. Decision was to restart the whole sync process if it was not finished (in case of the error). For this purpose was created an additional service. Let’s call it the Resync service. We still keep the id pairs in both systems, but only for the fast access not for the synchronization process. For the synchronizing these id-s now are kept in one main place, in the Resync service database. The Resync service keeps record as: ·       Id.A ·       Id.B ·       Entity.Type ·       Operation (Create, Update, Delete) ·       IsSyncStarted (true/false) ·       IsSyncFinished (true/false0 The example now looks like: 1.       System A creates id.A. id.A is saved on the A. Id.A is sent to the BizTalk. 2.       BizTalk sends id.A to the Resync and to the B. id.A is saved on the Resync. 3.       System B creates id.B. id.A+id.B are saved on the B. id.A+id.B are sent to the BizTalk. 4.       BizTalk sends id.A+id.B to the Resync and to the A. id.A+id.B are saved on the Resync. 5.       id.A+id.B are saved on the B. Resync changes the IsSyncStarted and IsSyncFinished flags accordingly. The Resync service implements three main methods: ·       Save (id.A, Entity.Type, Operation) ·       Save (id.A, id.B, Entity.Type, Operation) ·       Resync () Two Save() are used to save id-s to the service storage. See in the above example, in 2 and 4 steps. What about the Resync()? It is the method that finishes the interrupted synchronization processes. If Save() is started by the trigger event, the Resync() is working as an independent process. It periodically scans the Resync storage to find out “unfinished” records. Then it restarts the synchronization processes. It tries to synchronize them several times then gives up.     One more thing, both systems A and B must tolerate duplicates of one synchronizing process. Say on the step 3 the system B was not able to send id.A+id.B back. The Resync service must restart the synchronization process that will send the id.A to B second time. In this case system B must just send back again also created id.A+id.B pair without errors. That means “tolerate duplicates”. Fourth draft Next draft was created only because of the aesthetics. As it always happens, aesthetics gave significant performance gain to the whole system. First was the stupid question. Why do we need this additional service with special database? Can we just master the BizTalk to do something like this Resync() does? So the Resync orchestration is doing the same thing as the Resync service. It is started by the Id.A and finished by the id.A+id.B message. The first works as a Start message, the second works as a Finish message.     Here is a diagram the whole process without errors. It is pretty straightforward. The Resync orchestration is waiting for the Finish message specific period of time then resubmits the Id.A message. It resubmits the Id.A message specific number of times then gives up and gets suspended. It can be resubmitted then it starts the whole process again: waiting [, resubmitting [, get suspended]], finishing. Tuning up The Resync orchestration resubmits the id.A message with special “Resubmitted” flag. The subscription filter on the Resync orchestration includes predicate as (Resubmit_Flag != “Resubmitted”). That means only the first Sync orchestration starts the Resync orchestration. Other Sync orchestration instantiated by the resubmitting can finish this Resync orchestration but cannot start another instance of the Resync   Here is a diagram where system B was inaccessible for some period of time. The Resync orchestration resubmitted the id.A two times. Then system B got the response the id.A+id.B and this finished the Resync service execution. What is interesting about this, there were submitted several identical id.A messages and only one id.A+id.B message. Because of this, the system B and the Resync must tolerate the duplicate messages. We also told about this requirement for the system B. Now the same requirement is for the Resunc. Let’s assume the system B was very slow in the first response and the Resync service had time to resubmit two id.A messages. System B responded not, as it was in previous case, with one id.A+id.B but with two id.A+id.B messages. First of them finished the Resync execution for the id.A. What about the second id.A+id.B? Where it goes? So, we have to add one more internal requirement. The whole solution must tolerate many identical id.A+id.B messages. It is easy task with the BizTalk. I added the “SinkExtraMessages” subscriber (orchestration with one receive shape), that just get these messages and do nothing. Real design Real architecture is much more complex and interesting. In reality each system can submit several id.A almost simultaneously and completely unordered. There are not only the “Create entity” operation but the Update and Delete operations. And these operations relate each other. Say the Update operation after Delete means not the same as Update after Create. In reality there are entities related each other. Say the Order and Order Items. Change on one of it could start the series of the operations on another. Moreover, the system internals are the “black boxes” and we cannot predict the exact content and order of the operation series. It worth to say, I had to spend a time to manage the zombie message problems. The zombies are still here, but this is not a problem now. And this is another story. What is interesting in the last design? One orchestration works to help another to be more reliable. Why two orchestration design is more reliable, isn’t it something strange? The Synch orchestration takes all the message exchange between systems, here is the area where most of the errors could happen. The Resync orchestration sends and receives messages only within the BizTalk server. Is there another design? Sure. All Resync functionality could be implemented inside the Sync orchestration. Hey guys, some other ideas?

    Read the article

  • From the Coal Face - StyleCop 4.4.0

    - by TATWORTH
    Style Cop 4.4.0 is now out. This is a free download from http://stylecop.codeplex.com/ (please note the new location). This version is for VS2010. If you are usign an older version of Visual Studio you be prepared to keep to an older release like 4.3.0. The more I use StyleCop the more I like it. Code that is style cop compliant is much easier to pick up. It helps if you have GhostDoc (free) and Resharper (from jetBrains.Com)

    Read the article

  • install red5 demos via installer or within war file manually

    - by dursunturan
    I'm using Ubuntu 10.10 and installed the red5-server package. I've also downloaded oflaDemo.war file from that address. First I tried to install the oflaDemo via installer, but I couldnt reach the goal. I see the .war file under the /tmp directory, I got stuck with this message: "This may take a couple minutes, please wait". After that, I put the downloaded war file into the /webapps directory and wait 10 minutes as mentioned in red5-common.xml. Unfortunately, nothing changed ... So I decided to extract war file manually. I did this: jar -xvf oflaDemo.war Ok, I see all of the unzipped content under the webapps directory, but how can I preview the demo via a web browser? I really need to make live stream via Red5. Please help me.

    Read the article

  • Amazon EC2 instances changes server time/date on reboots and other time weirdness

    - by puffpio
    I have a windows instance up in EC2. I manually set the timezone to Pacific. 1) For some reason using window's built in time sync doesn't work in the instance...but whatever. I turn off automatic time syncing... but 2) On reboot the time on the server changes! For example, if i reboot it at 4PM on Wednesday, when the server comes back up it will read 12 noon on Thursday! As a result any access to Amazon's other services like SImpleDB fail because the timestamps generated are too far off the current time. Has anyone seen this or figured this out?

    Read the article

  • Windows Server 2003 IPSec Tunnel Connected, But Not Working (Possibly NAT/RRAS Related)

    - by Kevinoid
    Configuration I have setup a "raw" IPSec tunnel between a Windows Server 2003 (SBS) machine and a Netgear FVG318 according to the instructions in Microsoft KB816514. The configuration is as follows (using the same conventions as the article): NetA | SBS2003 | FVG318 | NetB 10.0.0.0/24 | 216.x.x.x | 69.y.y.y | 10.0.254.0/24 Both the Main Mode and Quick Mode Security Associations are successfully completed and appear in the IP Security Monitor. I am also able to ping the SBS2003 server on its private address from any computer on NetB. The Problem Any traffic sent from a computer on NetA to NetB, or from SBS2003 to NetB (excluding ICMP Ping responses), is sent out on the public network interface outside the IPSec tunnel (no encryption or header authentication, as if the tunnel were not there). Pings sent from a computer on NetB to a computer on NetA successfully reach computers on NetA, but the responses are silently discarded by SBS2003 (they do not go out in the clear and do not generate any encrypted traffic). Possible Solutions Incorrect Configuration I could have mistyped something, somewhere, or KB816514 could be incorrect in some way. I have tried very hard to eliminate the first option. Have re-created the configuration several times, tried tweaking and adjusting all the settings I could without success (most prevent the SA from being established). NAT/RRAS I have seen multiple posts elsewhere suggesting that this could be due to interaction between NAT and the IPSec filters. Possibly the NetA private addresses get rewritten to 216.x.x.x before being compared with the Quick Mode IPSec filters and don't get tunneled because of the mismatch. In fact, The Cable Guy article from June 2005 "TCP/IP Packet Processing Paths" suggests that this is the case, (see step 2 and 4 of the Transit Traffic path). If this is the case, is there a way to exclude NetA-NetB traffic from NAT? Any thoughts, ideas, suggestions, and/or comments are appreciated.

    Read the article

  • Running Java 32bit and 64bit on same computer

    - by Joris Meys
    I ran into a rather puzzling problem, trying to install Vuze 4.2.0.2 on my Windows 7. I have a Java 6 JDK 64bit, but Vuze complains that it can't find a correct 32bit JRE. Yet, as far as I know it shouldn't matter which Java is installed on the computer. (See also these answers). Now I was wondering : if it makes sense running a 32bit and a 64bit Java on the same machine, Whether that is possible, and if so what I should pay attention to in order to make sure that the correct Java is found. Thank you in advance PS : I have my reasons no to use the latest Vuze, so please don't tell me to update Vuze. I know.

    Read the article

  • PHP Array Not Working in Function

    - by lemonpole
    Hello all. I'm currently experimenting with arrays in PHP, and I created a fake environment where a team's information will be displayed. $t1 = array ( "basicInfo" => array ( "The Sineps", "December 25, 2010", "lemonpole" ), "overallRecord" => array (0, 0, 0, 0), "overallSeasons" => array ( 1 => array (14, 0, 0), 2 => array (9, 5, 2), 3 => array (12, 4, 0), 4 => array (3, 11, 2) ), "games" => array ( "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />", "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />", "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />", "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />" ), "seasonHistory" => array ( "Season I", "Season II", "Season III", "Season IV" ), "divisions" => array ( "Open", "Main", "Main", "Invite" ) ); // Displays the seasons the team has been in along // with the record of each season. function seasonHistory() { // Make array variable local-scope. global $t1; // Count the number of seasons. $numrows = count($t1["seasonHistory"]); // Loop through all the variables until // it reaches the last entry made and display // each item seperately. for($v = 0; $v <= $numrows; $v++) { // Echo each season. echo "<tr><td>{$t1["games"][$v]}</td>"; echo "<td>{$t1["seasonHistory"][$v]}</td>"; echo "<td>{$t1["divisions"][$v]}</td></tr>"; } } I have tested several possible problems out and after narrowing them down I have come down to one conclusion and that is my function is not connecting to the array for some reason. I don't know what else to do because I thought making the array global would fix that problem. What works: I can echo $t1["games"][0] on the page I need it to display and it gives me the content. I tried echo $t1["games"][0] INSIDE the function and then calling the function and it doesn't display anything.

    Read the article

  • How do I load a Direct X .x 3D model in iPhone SDK?

    - by Alex
    I have been searching the internet for the last few days trying to figure this out. My goal is to draw a textured and animated .x file exported from a 3D program. I found a tutorial of how to load and draw a .obj file, which I understand, but the tutorial doesn't say how to texture it, and .obj doesn't support animation. The .x file structure is human readable just like .obj, but I have no clue how to texture it, and I might be able to figure out how to animate it, but I would prefer to be instructed on that. Any help would be GREATLY appreciated.

    Read the article

  • servlet authentication and further reference to the credentials

    - by user553592
    What I got so far: It all begins with an HTML form which prompts the user for a username and password. From there it post the acquired user/pass to a servlet, GateKeeper. GateKeeper determines if the user/pass combination match any records in the MySQL database. Here is the sql I use: SELECT id FROM Users WHERE username='?' AND password=MD5('?') where the ? indicate information provided the previous HTML form. What I need now: I need some way to store the username and id of the record in the database. GateKeeper redirects the user to a control panel upon success. Therefore, I need a method to reference the username to display simple greetings, etc and also the id so it eliminates unnecessary calls to the database. The control panel may make AJAX calls to Servlets that preform some sort of task to the MySQL database.

    Read the article

  • using dummy row with NOT NULL to solve DEFAULT NULL

    - by Tony38
    I know having DEFAULT NULLS is not a good practice but I have many optional lookup values which are FK in the system so to solve this issue here is what i am doing: I use NOT NULL for every FK / lookup colunms. I have the first row in every lookup table which is PK id = 1 as a dummy row with just "none" in all the columns. This way I can use NOT NULL in my schema and if needed reference to the none row values PK =1 for FKs which do not have any lookup value. Is this a good design or any other work arounds? EDIT: I have: Neighborhood table Postal table. Every neighborhood has a city, so the FK can be NOT NULL. But not every postal code belongs to a neighborhood. Some do, some don't depending on the country. So if i use NOT NULL for the FK between postal and neighborhood then I will be screwed as there has to be some value entered. So what i am doing in essence is: have a row in every table to be a dummy row just to link the FKs. This way row one in neighborhood table will be: n_id = 1 name =none etc... In postal table I can have: postal_code = 3456A3 FK (city) = Moscow FK (neighborhood_id)=1 as a NOT NULL. If I don't have a dummy row in the neighborhood lookup table then I have to declare FK (neighborhood_id) as a Default null column and store blanks in the table. This is an example but there is a huge number of values which will have blanks then in many tables.

    Read the article

  • Ruby and Forking

    - by Cory
    Quick question about Ruby forking - I ran across a bit of forking code in Resque earlier that was sexy as hell but tripped me up for a few. I'm hoping for someone to give me a little more detail about what's going on here. Specifically - it would appear that forking spawns a child (expected) and kicks it straight into the 'else' side of my condition (less expected. Is that expected behavior? A Ruby idiom? My IRB hack here: def fork return true if @cant_fork begin if Kernel.respond_to?(:fork) Kernel.fork else raise NotImplementedError end rescue NotImplementedError @cant_fork = true nil end end def do_something puts "Starting do_something" if foo = fork puts "we are forking from #{Process.pid}" Process.wait else puts "no need to fork, let's get to work: #{Process.pid} under #{Process.ppid}" puts "doing it" end end do_something

    Read the article

  • mysql report sql help

    - by sfgroups
    I have mysql table with data like this. record will have server with total cpu and virtual server with cpu assinged type, cpu srv1, 10 vsrv11, 2 vsrv12, 3 srv2, 15 vsrv21, 6 vsrv22, 7 vsrv23, 1 from the above data, I want to create output like this. server, total cpu, assigned cpu, free cpu srv1, 10, 5, 5 srv2, 15, 14, 1 Can you help me on creating sql query for this report? I have changed my table and data like this. CREATE TABLE `cpuallocation` ( `servertype` varchar(10) DEFAULT NULL, `servername` varchar(20) DEFAULT NULL, `hostname` varchar(20) DEFAULT NULL, `cpu_count` float DEFAULT NULL, UNIQUE KEY `server_uniq_idx` (`servertype`,`servername`,`hostname`) insert into cpuallocation values('srv', 'server1', '',16); insert into cpuallocation values('vir', 'server1', 'host1',5); insert into cpuallocation values('vir', 'server1', 'host2',2.5); insert into cpuallocation values('vir', 'server1', 'host3',4.5); insert into cpuallocation values('srv', 'server2', '',8); insert into cpuallocation values('vir', 'server2', 'host1',5); insert into cpuallocation values('vir', 'server2', 'host2',2.5); insert into cpuallocation values('srv', 'server3', '',24); insert into cpuallocation values('vir', 'server3', 'host1',12); insert into cpuallocation values('vir', 'server3', 'host2',2); insert into cpuallocation values('srv', 'server4', '',12); Update: I created two view, now I getting the result I want. create view v1 as select servername, sum(cpu_count) as cpu_allocated from cpuallocation where servertype='vir' group by servername; create view v2 as select servername, cpu_count as total_cpu from cpuallocation where servertype='srv'; select a.servername, a.total_cpu, b.cpu_allocated from v2 as a left join v1 as b on a.servername=b.servername; +------------+-----------+---------------+ | servername | total_cpu | cpu_allocated | +------------+-----------+---------------+ | server1 | 16 | 12 | | server2 | 8 | 7.5 | | server3 | 24 | 14 | | server4 | 12 | NULL | +------------+-----------+---------------+ 4 rows in set (0.00 sec) Is it possible to create a query with-out creating views?

    Read the article

  • shorten something in AS 2.0 using eval or set?

    - by chris
    eval("_parent.volumetone" + target1)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target2)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target3)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target4)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target5)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target6)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target7)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target8)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target9)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target10)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target11)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target12)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target13)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target14)._yscale = Math.round(number)/1.5+50; eval("_parent.volumetone" + target15)._yscale = Math.round(number)/1.5+50; i have these lines of repetitive code. the variables target1 to target15 are a random number between 1 and 110. so one may point to _parent.volumetone49 and adjust its _yscale for example. the code above works the way i want, but i want it shorter. here's something i tried with no success: for (i = 0; i < 15; i++) { set("_parent.volumetone" + ("target"+i) + "._xscale", Math.round(funhousenumber)/1.5+50); } basically having a loop that starts at 1 and goes to 15, then replaces target1 with target+i, i being 1, which would give target1 and thus the number contained in it. maybe i have to use eval()? i'm still not sure what i'm doing but i'm learning as i go. thanks.

    Read the article

  • is there any way to make my jquery search better ?

    - by From.ME.to.YOU
    Hello var myarr= Array('test1','test2','test3'); var searchTerm = "test"; var rSearchTerm = new RegExp( searchTerm,'i'); $.each(myarr, function(i) { if (myarr[i].match(rSearchTerm)) { //item found } });? guys is there any way to make my search algorithm better ? "myarr" will be a big array so i want to make sure that i'm using the best way to search in it thanks alot

    Read the article

  • Rails - Vestal Versions - Access previous version data w/o restoring?

    - by AnApprentice
    Hello, I'd like to use vestal versions to do the following: Determine the Content of the current record being saved Determine the Content of the last record saved In my model I have: class Note < ActiveRecord::Base versioned :if => :really_create_a_version? def really_create_a_version? XXXXXXXXXXXXXX XXXXXXXXXXXXXX end end Where the XXXX are, how can I get the note.content of the item about to be saved (i'm assuming it hasn't been saved yet to the DB? Is that correct? Also, how can I get the note.content of the save before the current save in progress? Thanks

    Read the article

  • DOM Storage and locks

    - by user535759
    Since DOM storage and its equivalencies persist in between tabs and windows, I've thought about using it for message passing. The problem is that fetch and store are different operations, and therefore not atomic. I have models that rely on UUID generation, conflict resolutions, and beaconing to do the small subset of what I need to do, but my real question is this: Since the local storage is a shared memory resource, what are the locking mechanisms available for mutual access?

    Read the article

  • SEO google keyword position tools?

    - by Peterl86
    Hi guys, I want to check our google postions for several keywords every day and make a note in a spreadseet. At the moment, we have a student doing it but it's a rubbish job and it doesn't seem fair on them! Are there any tools available to automate this process? I have tried rankchecker by seobook.com, but although that should be exactly what im looking for when i set scheduled tasks in that, it doesnt work. Any tips would be appreciated, thanks! peter EDIT: Liam has suggested a Python script to do this, which unfortunately isnt something I'm very familiar with! If anyone knows of a good tutorial or something to help us with this, that would be brilliant. Update: Found a php script at seoscript.net which looks like a step in the right direction. But I cant get it to work! I get this error. Anyone more knowledgabe than me know how to fix that? I have PEAR installed. thanks again, Peter

    Read the article

  • PLPGSQL array assignment not working, "array subscript in assignment must not be null"

    - by Koen Schmeets
    Hello there, When assigning mobilenumbers to a varchar[] in a loop through results it gives me the following error: "array subscript in assignment must not be null" Also, i think the query that joins member uuids, and group member uuids, into one, grouped on the user_id, i think it can be done better, or maybe this is even why it is going wrong in the first place! Any help is very appreciated.. Thank you very much! CREATE OR REPLACE FUNCTION create_membermessage(in_company_uuid uuid, in_user_uuid uuid, in_destinationmemberuuids uuid[], in_destinationgroupuuids uuid[], in_title character varying, in_messagecontents character varying, in_timedelta interval, in_messagecosts numeric, OUT out_status integer, OUT out_status_description character varying, OUT out_value VARCHAR[], OUT out_trigger uuid[]) RETURNS record LANGUAGE plpgsql AS $$ DECLARE temp_count INTEGER; temp_costs NUMERIC; temp_balance NUMERIC; temp_campaign_uuid UUID; temp_record RECORD; temp_mobilenumbers VARCHAR[]; temp_destination_uuids UUID[]; temp_iterator INTEGER; BEGIN out_status := NULL; out_status_description := NULL; out_value := NULL; out_trigger := NULL; SELECT INTO temp_count COUNT(*) FROM costs WHERE costtype = 'MEMBERMESSAGE' AND company_uuid = in_company_uuid AND startdatetime < NOW() AND (enddatetime > NOW() OR enddatetime IS NULL); IF temp_count > 1 THEN out_status := 1; out_status_description := 'Invalid rows in costs table!'; RETURN; ELSEIF temp_count = 1 THEN SELECT INTO temp_costs costs FROM costs WHERE costtype = 'MEMBERMESSAGE' AND company_uuid = in_company_uuid AND startdatetime < NOW() AND (enddatetime > NOW() OR enddatetime IS NULL); ELSE SELECT INTO temp_costs costs FROM costs WHERE costtype = 'MEMBERMESSAGE' AND company_uuid IS NULL AND startdatetime < NOW() AND (enddatetime > NOW() OR enddatetime IS NULL); END IF; IF temp_costs != in_messagecosts THEN out_status := 2; out_status_description := 'Message costs have changed during sending of the message'; RETURN; ELSE SELECT INTO temp_balance balance FROM companies WHERE company_uuid = in_company_uuid; SELECT INTO temp_count COUNT(*) FROM users WHERE (user_uuid = ANY(in_destinationmemberuuids)) OR (user_uuid IN (SELECT user_uuid FROM targetgroupusers WHERE targetgroup_uuid = ANY(in_destinationgroupuuids)) ) GROUP BY user_uuid; temp_campaign_uuid := generate_uuid('campaigns', 'campaign_uuid'); INSERT INTO campaigns (company_uuid, campaign_uuid, title, senddatetime, startdatetime, enddatetime, messagetype, state, message) VALUES (in_company_uuid, temp_campaign_uuid, in_title, NOW() + in_timedelta, NOW() + in_timedelta, NOW() + in_timedelta, 'MEMBERMESSAGE', 'DRAFT', in_messagecontents); IF in_timedelta > '00:00:00' THEN ELSE IF temp_balance < (temp_costs * temp_count) THEN UPDATE campaigns SET state = 'INACTIVE' WHERE campaign_uuid = temp_campaign_uuid; out_status := 2; out_status_description := 'Insufficient balance'; RETURN; ELSE UPDATE campaigns SET state = 'ACTIVE' WHERE campaign_uuid = temp_campaign_uuid; UPDATE companies SET balance = (temp_balance - (temp_costs * temp_count)) WHERE company_uuid = in_company_uuid; SELECT INTO temp_destination_uuids array_agg(DISTINCT(user_uuid)) FROM users WHERE (user_uuid = ANY(in_destinationmemberuuids)) OR (user_uuid IN(SELECT user_uuid FROM targetgroupusers WHERE targetgroup_uuid = ANY(in_destinationgroupuuids))); RAISE NOTICE 'Array is %', temp_destination_uuids; FOR temp_record IN (SELECT u.firstname, m.mobilenumber FROM users AS u LEFT JOIN mobilenumbers AS m ON m.user_uuid = u.user_uuid WHERE u.user_uuid = ANY(temp_destination_uuids)) LOOP IF temp_record.mobilenumber IS NOT NULL AND temp_record.mobilenumber != '' THEN --THIS IS WHERE IT GOES WRONG temp_mobilenumbers[temp_iterator] := ARRAY[temp_record.firstname::VARCHAR, temp_record.mobilenumber::VARCHAR]; temp_iterator := temp_iterator + 1; END IF; END LOOP; out_status := 0; out_status_description := 'Message created successfully'; out_value := temp_mobilenumbers; RETURN; END IF; END IF; END IF; END$$;

    Read the article

  • Why does Perl lose foreign characters on Windows; can this be fixed (if so, how)?

    - by Alex R
    Note below how ã changes to a. NOTE2: Before you blame this on CMD.EXE and Windows pipe weirdness, see Experiment 2 below which gets a similar problem using File::Find. The particular problem I'm trying to fix involves working with image files stored on a local drive, and manipulating the file names which may contain foreign characters. The two experiments shown below are intermediate debugging steps. The ã character is common in latin languages. e.g. http://pt.wikipedia.org/wiki/Cão Experiment 1 Experiment 2 To get around my particular problem, I tried using File::Find instead of piped input. The issue actually gets worse: Debugging update: I tried some of the tricks listed at http://perldoc.perl.org/perlunicode.html, e.g. use utf8, use feature 'unicode_strings', etc, to no avail. Environment and Version Info The OS is Windows 7, 64-bit. The Perl is: This is perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x64-multi-thread (with 8 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall Binary build 1202 [293621] provided by ActiveState http://www.ActiveState.com Built Sep 6 2010 22:53:42

    Read the article

  • Listing and deleting Git commits that are under no branch (dangling?)

    - by Samer Abukhait
    I've got a git repository with plenty of commits that are under no particular branch, I can git show them but when I try to list branches that contain them, it reports back nothing: I thought this is the dangling commits/tree issue (as a result of -D branch), so I pruned the repo, but I still see the case after that: $ git fetch origin $ git fsck --unreachable $ git fsck No output, nothing dangling (right?) $ git show 793db7f272ba4bbdd1e32f14410a52a412667042 commit 793db7f272ba4bbdd1e32f14410a52a412667042 Author: .. But $ git branch --contains 793db7f272ba4bbdd1e32f14410a52a412667042 Gives no output What exactly is the state of that commit? How can I list all commits with similar state, How can I delete commits like those?

    Read the article

  • Custom QAction/QMenu for mouse button detection

    - by voodoogiant
    I'm trying to create a popup menu, where I can detect the mouse button that was pressed for a given item. I've created a custom QAction already to build my QMenu, but the triggered signal when the menu item is pressed doesn't provide a QMouseEvent for me to query the button pressed. Also, I'm setting the a status tip for each QAction, which appears in the status bar when I mouse over it, but it stays even after I close the QMenu. Is this normal behavior?

    Read the article

  • Trouble installing Rhodes framework

    - by user94154
    When I run rake run:android, I get the error (I'm using Ubuntu): Your java bin folder does not appear to be on your path. This is required to use rhodes. Here is the relevant part of my bash.bashrc file: export PATH="$PATH:$HOME/ruby/gems/bin" export GEM_HOME="$HOME/ruby/gems" export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8" export GEM_CACHE="$GEM_HOME/cache" export RUBYOPT=rubygems export ANDROID_HOME="/home/username/ruby_files/android-sdk-linux_86" PATH="$PATH:$ANDROID_HOME/tools" export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0_21 export JAVA_HOME PATH=$PATH:$JAVA_HOME/bin export PATH

    Read the article

  • How does the linux kernel manage less than 1GB physical memory ?

    - by TheLoneJoker
    I'm learning the linux kernel internals and while reading "Understanding Linux Kernel", quite a few memory related questions struck me. One of them is, how the Linux kernel handles the memory mapping if the physical memory of say only 512 MB is installed on my system. As I read, kernel maps 0(or 16) MB-896MB physical RAM into 0xC0000000 linear address and can directly address it. So, in the above described case where I only have 512 MB: How can the kernel map 896 MB from only 512 MB ? What about user mode processes in this situation? Where are user mode processes in phys RAM? Every article explains only the situation, when you've installed 4 GB of memory and the kernel maps the 1 GB into kernel space and user processes uses the remaining amount of RAM. I would appreciate any help in improving my understanding. Thanks..!

    Read the article

  • Python virtualenv questions

    - by orokusaki
    I'm using VirtualEnv on Windows XP. I'm wondering if I have my brain wrapped around it correctly. I ran virtualenv ENV and it created C:\WINDOWS\system32\ENV. I then changed my PATH variable to include C:\WINDOWS\system32\ENV\Scripts instead of C:\Python27\Scripts. Then, I checked out Django into C:\WINDOWS\system32\ENV\Lib\site-packages\django-trunk, updated my PYTHON_PATH variable to point the new Django directory, and continued to easy_install other things (which of course go into my new C:\WINDOWS\system32\ENV\Lib\site-packages directory). I understand why I should use VirtualEnv so I can run multiple versions of Django, and other libraries on the same machine, but does this mean that to switch between environments I have to basically change my PATH and PYTHON_PATH variable? So, I go from developing one Django project which uses Django 1.2 in an environment called ENV and then change my PATH and such so that I can use an environment called ENV2 which has the dev version of Django? Is that basically it, or is there some better way to automatically do all this (I could update my path in Python code, but that would require me to write machine-specific code in my application)? Also, how does this process compare to using VirtualEnv on Linux (I'm quite the beginner at Linux).

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25  | Next Page >